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
Dim SQLString
SQLString = "SELECT empLastName, empFirstName, empLoginName, " & _
" employeeTypeID FROM dbo.Employee " & _
" WHERE empLoginName = " & "'" & loginName & "'" & ";"
response.write SQLString
rst.Open SQLString, _
cnn, adOpenForwardOnly, _
adLockReadOnly, adCmdTable