How to display information from a MySQL database record in a listview?
I tried it like this but it did not 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"));
}
}
}