Following is the code to add data in database using sql server2008.. but it is not working.. tried the same with other database but not working in this.. please help to solve this problem
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RegConnectionString"].ConnectionString);
con.Open();
string insCmd = "Insert into order(BookName,Author,Category,Publisher,Edition,Price,Quantity) values(@BookName,@Author,@Category,@Publisher,@Edition,@Price,@Quantity)";
SqlCommand insertUser = new SqlCommand(insCmd, con);
insertUser.Parameters.AddWithValue("@BookName", TextBox1.Text);
insertUser.Parameters.AddWithValue("@Author", TextBox2.Text);
insertUser.Parameters.AddWithValue("@Category", DropDownList1.SelectedItem.ToString());
insertUser.Parameters.AddWithValue("@Publisher", TextBox3.Text);
insertUser.Parameters.AddWithValue("@Edition", TextBox4.Text);
insertUser.Parameters.AddWithValue("@Price", TextBox5.Text);
insertUser.Parameters.AddWithValue("@Quantity", TextBox6.Text);
insertUser.ExecuteNonQuery();
con.Close();
Response.Redirect("bookordered.aspx");
Error:
Incorrect syntax near the keyword 'order'.
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'