473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

[SqlException: Line 1: Incorrect syntax near '.'.]

I see this error in my ASP .NET code:

[SqlException: Line 1: Incorrect syntax near '.'.]

I am trying to execute the following:
private const string SQL_SELECT_USER = "SELECT User.Email, User.FirstName,
User.LastName, User.Status, User.Phone, User.Privs FROM User INNER JOIN
Login ON User.UserId = Login.UserId WHERE Login.UserId = @UserId AND
Login.Password = @Password";

Any ideas here?

Thanks

Rog
Nov 15 '05 #1
2 4319
"User" is a reserved keyword on SQLServer

Use Brackets "[]" like [User] instead of User.

hth
Uwe
"Roger R. Smith" <ro******@cisco.com> schrieb im Newsbeitrag
news:1065678795.255298@sj-nntpcache-3...
I see this error in my ASP .NET code:

[SqlException: Line 1: Incorrect syntax near '.'.]

I am trying to execute the following:
private const string SQL_SELECT_USER = "SELECT User.Email, User.FirstName,
User.LastName, User.Status, User.Phone, User.Privs FROM User INNER JOIN
Login ON User.UserId = Login.UserId WHERE Login.UserId = @UserId AND
Login.Password = @Password";

Any ideas here?

Thanks

Rog

Nov 15 '05 #2
Thank you very much Uwe. That was it!
thank you for taking the time to help me.
Rog
"Uwe Hafner" <sp********@NOSPAM.de> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
"User" is a reserved keyword on SQLServer

Use Brackets "[]" like [User] instead of User.

hth
Uwe
"Roger R. Smith" <ro******@cisco.com> schrieb im Newsbeitrag
news:1065678795.255298@sj-nntpcache-3...
I see this error in my ASP .NET code:

[SqlException: Line 1: Incorrect syntax near '.'.]

I am trying to execute the following:
private const string SQL_SELECT_USER = "SELECT User.Email, User.FirstName, User.LastName, User.Status, User.Phone, User.Privs FROM User INNER JOIN
Login ON User.UserId = Login.UserId WHERE Login.UserId = @UserId AND
Login.Password = @Password";

Any ideas here?

Thanks

Rog


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bdastani | last post by:
I am trying to initialize a dataReader in C#, but I keep on gettin an exception error stating the following: System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,...
2
by: Patrick.O.Ige | last post by:
Can anybody body tell me what my error is here its saying :- System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'. SQLString = "UPDATE treetable SET " & _ "ParentID =...
3
by: Patrick.O.Ige | last post by:
Hi guys, I'm getting error:- System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '='. What could cause this ERRORR My code below:- Dim connString As String =...
4
by: Patrick Olurotimi Ige | last post by:
why is this giving me error System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '='.?? my code is in c# strSql = "Update addmessage Set message = '"+null+"' Where ID=" +ID; ...
1
by: Sandesh | last post by:
Hello All, Me saying " has any body come across such error would be underestimating". Well I am getting a very peculiar and unique error "Line 1: Incorrect syntax near 'Actions'." ...
6
by: martin1 | last post by:
I just use DataSet to bind DataSetGrid and display from SQL DB. when starting run in Visual Studio 2005, get "Line 1: Incorrect syntax near '1'" error message from below fill line, ...
1
by: harleedavidson | last post by:
Using SqlBulkCopy.WriteToServer to upload a datatable and getting: System.Data.SqlClient.SqlException Line 1: Incorrect syntax near 'COLLATE'. Database Server is SQL2000, database in in 6.5...
1
by: iporter | last post by:
In the following code, the two Response.Write statements output exactly the same - I can copy and paste both into Query Analyzer, and run them fine. However, if I comment out line 3, the...
1
by: Ruth413 | last post by:
Hello - I am getting the these errors in my sql 2005 generated script. I am stuck with first error. Please help.... Msg 102, Level 15, State 1, Line 3 Incorrect syntax near '('. Msg 319,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.