PDA

View Full Version : Incorrect syntax near the keyword 'AND'


chrisjchrisj
03-12-2008, 11:34 PM
Hi,

Could you help me resolve this error please?

"Microsoft OLE DB Provider for SQL Server error '80040e14'
Incorrect syntax near the keyword 'AND'.
/uploadtester.asp, line 12"


Line 12 is:
set PPLRS = MyConn.Execute( "SELECT * from mms_tbl_user_cate where fldUSER_ID = " & session( "PMMS_ID" ) & " AND fldCATE_ID = 3" )

Thank you.

Call OPEN_DB()

set PPLRS = MyConn.Execute( "SELECT * from mms_tbl_user_cate where fldUSER_ID = " & session( "PMMS_ID" ) & " AND fldCATE_ID = 3" )

IF NOT PPLRS.EOF THEN
PPL_GROUP_MEMBER = "Y"
END IF
set PPLRS = nothing
MyConn.close
Set MyConn = Nothing

mjlorbet
03-13-2008, 02:28 AM
"SELECT * from mms_tbl_user_cate where fldUSER_ID = '" & session( "PMMS_ID" ) & "' AND fldCATE_ID = 3"


i'm assuming the value of the data you're passing in isn't a number type, thus there are no wrapping quotes to appease the sql gods, the single quotes inside the double quotes will account for this.