Запрос на обновление не работает
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll Additional information: Incorrect syntax near '='.
private void buttonupdate_Click(object sender, EventArgs e) { connection.Open(); //SqlCommand command = new SqlCommand(); //command.Connection = connection; SqlCommand command = new SqlCommand("UPDATES entry SET Name = @name, Father Name = @fathername, Gender = @gender, CNIC = @cnic, Mobile = @mobile, Date of Birth = @birthdate, Address = @address,Village Council = @vc, Tehsil = @tehsil, District = @district, occupation = @occupation where Serial No = @serialno", connection); command.Parameters.Add(new SqlParameter("@serialno", textBoxserialno.Text)); command.Parameters.Add(new SqlParameter("@name", textBoxname.Text)); command.Parameters.Add(new SqlParameter("@fathername", textBoxfathername.Text)); command.Parameters.Add(new SqlParameter("@gender", comboBoxgender.GetItemText(comboBoxgender.SelectedItem))); command.Parameters.Add(new SqlParameter("@cnic", textBoxcnic.Text)); command.Parameters.Add(new SqlParameter("@mobile", textBoxmobile.Text)); command.Parameters.Add(new SqlParameter("@birthdate", dateTimePickerdob.Value.ToString())); command.Parameters.Add(new SqlParameter("@address", textBoxvillage.Text)); command.Parameters.Add(new SqlParameter("@vc", textBoxvc.Text)); command.Parameters.Add(new SqlParameter("@tehsil", textBoxtehsil.Text)); command.Parameters.Add(new SqlParameter("@district", textBoxdistrict.Text)); command.Parameters.Add(new SqlParameter("@occupation", textBoxoccupation.Text)); command.ExecuteNonQuery(); connection.Close(); MessageBox.Show(textBoxname.Text, "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); }
Что я уже пробовал:
Я пытался, но безуспешно.
Maciej Los
UPDATES
??- Так и должно быть UPDATE
!!!
AttaUrRahman
Спасибо.