一直试图找出这个30分钟但仍然不明白为什么这不会更新值...在我点击更新按钮后没有任何反应......这里是代码
try
{
MySqlConnection connection = new MySqlConnection(MyConnectionString);
MySqlCommand cmd;
connection.Open();
cmd = connection.CreateCommand();
cmd.CommandText = "UPDATE student_info SET SEM = @SEM, STUDENT_NO = @STUDENT_NO, LASTNAME = @LASTNAME" +
", FIRSTNAME = @FIRSTNAME, MIDDLENAME = @MIDDLENAME, CITY = @CITY, STREET = @STREET, GENDER = @GENDER" +
", COURSE = @COURSE, YEAR = @YEAR, SECTION = @SECTION, BIRTHDAY = @BIRTHDAY Where STUDENT_NO = @STUDENT_NO";
cmd.Parameters.AddWithValue("@SEM", sem_combo.Text);
cmd.Parameters.AddWithValue("@STUDENT_NO", studentNo_txt.Text);
cmd.Parameters.AddWithValue("@LASTNAME", lname_txt.Text);
cmd.Parameters.AddWithValue("@FIRSTNAME", fname_txt.Text);
cmd.Parameters.AddWithValue("@MIDDLENAME", mname_txt.Text);
cmd.Parameters.AddWithValue("@CITY", address_txt.Text);
cmd.Parameters.AddWithValue("@STREET", street_txt.Text);
cmd.Parameters.AddWithValue("@GENDER", gender_combo.Text);
cmd.Parameters.AddWithValue("@COURSE", program_combo.Text);
cmd.Parameters.AddWithValue("@YEAR", yr_combo.Text);
cmd.Parameters.AddWithValue("@SECTION", section_combo.Text);
cmd.Parameters.AddWithValue("@BIRTHDAY", bday.Text);
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "UPDATE contacts SET EMAIL = @EMAIL, CELL_NO = @CELL_NO Where STUDENT_NO = @STUDENT_NO";
cmd.Parameters.AddWithValue("@EMAIL", email_txt.Text);
cmd.Parameters.AddWithValue("@CELL_NO", contact_txt.Text);
cmd.Parameters.AddWithValue("@STUDENT_NO", studentNo_txt.Text);
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
MessageBox.Show("updated");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}