Reputation: 1
My code generates the following error:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information:
Incorrect syntax near ')'.
My code is:
conn.Open();
SqlDataAdapter sda = new SqlDataAdapter("Update [Table] Set [Name]='" + textBox2.Text + "',[Course]='" + comboBox1.Text + "',[YearSection]='" + textBox3.Text + "' Where [Id]='"+textBox1.Text+"')", conn);
sda.SelectCommand.ExecuteNonQuery();
conn.Close();
MessageBox.Show("Updated Successfully !!!");
Can someone help me understand why this doesn't work.
Upvotes: 0
Views: 1259