I have a problem with this code, because it gives me following error message
Object reference not set to an instance of an object when I use the line
values[countValues] = reader2.GetString("textinfo"); in the code below
Can someone help me?
public static string[] values; int countValues = 0; using (var connection = new MySqlConnection(connString)) { connection.Open(); string query = "select * from showvalues where idvalue = '" + idStatus + "'"; using (var command2 = new MySqlCommand(query, connection)) { using (var reader2 = command2.ExecuteReader()) { while (reader2.Read()) { listBoxMeasurement.Items.Add(reader2.GetString("textinfo")); values[countValues] = reader2.GetString("textinfo"); countValues++; } countValues = 0; connection.Close(); } } }