Incorrect syntax near ','.
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 ','.
Line 46: dataConnection.Open();
Line 48: dataCommand.ExecuteNonQuery();
Line 49: dataConnection.Close();
Source File: c:\Users\sujit\Documents\Visual Studio 2008\WebSites\WebSite1\Default.aspx.cs Line: 48
The similar INSERT statement has been working in one of the other page, but this.
What could be the problem, please?
For MS SQL Server, you don't have to include the parens around the entire set of values for it to work. Your syntax should look like this: ... You just keep tacking on a comma and the next set of values. Compare with your technique: ... The parens surrounding the list of value sets are extraneous. Hope that helps!
Front end is Visual Studio 2008, and back end is default sql server that comes within the Visual Studio.
And yes, somehow you are getting it right. Even though I make it a 2 line statement rather than 500, still the error pops. What should I do, if the database doesn't allow multiple inserts at once?