1
how to display the information of a Mysql database record in a listview?
I tried it but it didn’t work.
using (_connection = new MySql.Data.MySqlClient.MySqlConnection("Database=teste; Data Source=192.168.0.17;User Id=RFID;Password=1234;SslMode=None;"))
{
System.Text.EncodingProvider ppp;
ppp = System.Text.CodePagesEncodingProvider.Instance;
Encoding.RegisterProvider(ppp);
_connection.Open();
var cmd = new MySqlCommand("SELECT distinct id, Placa FROM test", _connection);
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
listView.Items.Add("Registro: " +reader.GetString("id") + reader.GetString("\nPlaca"));
}
}
}