MySql.Data.MySqlClient.MySqlException: '您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行 'not=41, durum='BASARIZ'Where id=2' 附近使用的正确语法
\n int i = 0;\n private void button2_Click(object sender, EventArgs e)\n {\n int not = Convert.ToInt16(comboBox5.Text) + Convert.ToInt16(comboBox3.Text) + Convert.ToInt16(comboBox4.Text) + Convert.ToInt16(comboBox6.Text) + Convert.ToInt16(comboBox7.Text) + Convert.ToInt16(comboBox8.Text) + Convert.ToInt16(comboBox9.Text) + Convert.ToInt16(comboBox10.Text) + Convert.ToInt16(comboBox11.Text) + Convert.ToInt16(comboBox12.Text) + Convert.ToInt16(comboBox13.Text) + Convert.ToInt16(comboBox14.Text) + Convert.ToInt16(comboBox15.Text) + Convert.ToInt16(comboBox16.Text) + Convert.ToInt16(comboBox17.Text) + Convert.ToInt16(comboBox18.Text) + Convert.ToInt16(comboBox19.Text) + Convert.ToInt16(comboBox20.Text) + Convert.ToInt16(comboBox21.Text);\n\n\n conn.Open();\n string update = "Update ogrenci Set not=@not, durum=@durum Where id=@id";\n cmd = new MySqlCommand(update, conn);\n\n cmd.Parameters.AddWithValue("@not", not);\n cmd.Parameters.AddWithValue("@durum", comboBox22.Text);\n cmd.Parameters.AddWithValue("@id", dataGridView1.Rows[i].Cells[0].Value);\n\n cmd.ExecuteNonQuery();\n\n MessageBox.Show("Ba\xc5\x9far\xc4\xb1yla G\xc3\xbcncellendi.");\n\n conn.Close();\n\n getOgrenci();\n }\n private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)\n {\n i = e.RowIndex;\n textBox1.Text = dataGridView1.Rows[i].Cells[2].Value.ToString();\n textBox4.Text = dataGridView1.Rows[i].Cells[3].Value.ToString();\n textBox2.Text = dataGridView1.Rows[i].Cells[6].Value.ToString();\n }\nRun Code Online (Sandbox Code Playgroud)\n这是我的代码,所以我不明白为什么我会收到语法错误,而我没有任何语法问题。
\n