I am writing a student database program on C# using MySql. I want to update the information but it's always giving me that error. Here is the program I wrote.
private void Update_bttn_Click(object sender, EventArgs e)
{
string ConString = " datasource = localhost; port = 3306; username = root; password = 3306";
string Query = " Update studentdata.studentrecord set (CourseId = '" + this.crsId.Text + "', CourseName = '" + this.crsName.Text + "',Credits = '" + this.credits.Text + "', CourseStatement = '" + this.CrseStatment.Text + "',Grade = '" + this.Grades.Text + "' where CourseId = '" + this.crsId.Text+"' ; ";
MySqlConnection ConDatabase = new MySqlConnection(ConString);
MySqlCommand cmdDataBase = new MySqlCommand(Query, ConDatabase);
MySqlDataReader myReader;
try
{
ConDatabase.Open();
myReader = cmdDataBase.ExecuteReader();
MessageBox.Show("Information Updated");
while ((myReader.Read())) { }
ConDatabase.Close();
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
}