This my work. The problem occurs with cmd.ExecuteNonQuery
.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'Order'.
Source Error: Line 44:cmd.ExecuteNonQuery();
protected void Button2_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("insert into Order values('" +DropDownList1.SelectedValue+"','" +DropDownList2.SelectedValue+ "','" +txtQuantity.Text+ "','" +DropDownList3.SelectedValue+ "','" +TextBox1.Text+ "')", con);
cmd.ExecuteNonQuery();
con.Close();
DropDownList1.SelectedValue= "";
DropDownList2.SelectedValue = "";
txtQuantity.Text = "";
DropDownList3.SelectedValue= "";
TextBox1.Text = "";
}