0

Hi all,
I have written sql code to create a SQL Server CE database to be deployed on a Windows Mobile emulator using the SqlCeEngine object. The sql statements are enclosed in the form load procedure. However, when i run the program i get the following error: There was an error parsing the query [ Token line number = 1,Token line offset = 14,Token in error = User ] which references the sqlcreateTable.ExecuteNonQuery() method.
I have looked up the meaning of this SqlCeException on MSDN but no help there. Can any one explain what i may be doing wrong? Below is a snippet of code that produces the error:

sqlCreateTable.CommandText = "CREATE TABLE User(userID int PRIMARY KEY, " +
                             "username nvarchar, password nvarchar)";
[B]sqlCreateTable.ExecuteNonQuery();[/B] // produces an SqlCeException error message
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by jockfaire
0

Well... by looking to command text, you are creating a table named "User".

"User" is Reserved keyword of MS SQL.

Microsoft SQL Server uses reserved keywords for defining, manipulating, and accessing databases. Reserved keywords are part of the grammar of the Transact-SQL language used by SQL Server to parse and understand Transact-SQL statements and batches.

For more information refer below link:
http://msdn.microsoft.com/en-us/library/aa258313(SQL.80).aspx

0

Well... by looking to command text, you are creating a table named "User".

"User" is Reserved keyword of MS SQL.

Microsoft SQL Server uses reserved keywords for defining, manipulating, and accessing databases. Reserved keywords are part of the grammar of the Transact-SQL language used by SQL Server to parse and understand Transact-SQL statements and batches.

For more information refer below link:
http://msdn.microsoft.com/en-us/library/aa258313(SQL.80).aspx

Thank You. It worked. I am new to SQL Server and had no idea that 'User' was a reserved word. The post has been marked as solved.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.