1
With this code I add items to listbosx with the amount of record I have. How to have a check before to know if the entry of that record has been added and not act item with the same id number?
private void button_Click(object sender, RoutedEventArgs e)
{
using (_connection = new 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 FROM test", _connection);
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
listBox.Items.Add(("Registro: " +reader.GetString("id")));
}
}
}