2
Answers

invalid attempt to access a field before calling read() c#

Bharathi Raja

Bharathi Raja

7y
156
1
connection.Close();
connection.Open();
cmd = new MySqlCommand("select attend from credit_purchase where date='" + date + "'", connection);
dread = cmd.ExecuteReader();
while (dread.Read())
{
x = dread.GetValue(0).ToString();//this line to error
}
dread.close(); 
connection.close(); 
Answers (2)