With this code I add items to listbosx with the amount of registration I have. How to have a check before to know if the item of that record has already been added and does not act item with the same none of id?
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")));
}
}
}