Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP using a string variables - not working

Status
Not open for further replies.

cmmrfrds

Programmer
Feb 13, 2000
4,690
US
I use this type of string variable in Access to read tables and it works fine, but is ASP I am getting an error that says "incorrect syntax near keyword SELECT". If I substitute the table name for SQLString then it works. What is going on??? Do I need to cast the variable so that ASP knows it is a string??

Dim SQLString
SQLString = "SELECT empLastName, empFirstName, empLoginName, " & _
" employeeTypeID FROM dbo.Employee " & _
" WHERE empLoginName = " & "'" & loginName & "'" & ";"

response.write SQLString

rst.Open SQLString, _
cnn, adOpenForwardOnly, _
adLockReadOnly, adCmdTable

 
Have you tried removing the "dbo." from employees? Also, make it one long string. Don't break it up with the " & _
and see if it makes any difference. Sometimes it does.
 
Thank you for the response, but I found the error. I had forgotten to remove the "adCmdTable" from the Open call since I had been using a table instead of the string.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top