Using C # and MySQL
When I select a combobox value, the corresponding value should appear in the text box
C # code.
cmd2 = new OdbcCommand("Select name from users where username='" + cmbuser.Text + "'", con);
dr= cmd2.ExecuteReader();
while (dr.Read())
{
txtusername.Text = dr("user");
}
The above code works in VB.Net, but an error is displayed in C #, since the error "dr" is a "field", but is used as a "method"
This line displays an error txtusername.Text = dr("user");
How to solve this error, what is the problem in my code.
C # code help
source
share