I try to load my data into array.But the error said "Object reference not set to an instance of an object".
public void UpDate()
{
int i = 0;
MySqlConnection con = new MySqlConnection("host=localhost;user=MyUser;password=MyPass;database=MyDatabase");
string sql = "SELECT * FROM queue ORDER BY Time DESC ";
MySqlCommand cmd = new MySqlCommand(sql, con);
con.Open();
MySqlDataReader read = cmd.ExecuteReader();
while (read.Read())
{
DataQ[i] = read.GetString("queue"); //Error "Object reference not set to an instance of an object"
DataT[i] = read.GetString("Time");
i++;
}
con.Close();
}