发生这样的错误应该怎么样改正呢?
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14'
[Microsoft][ODBC Microsoft Access Driver] 语法错误 (操作符丢失) 在查询表达式 'AND USERNAME='aa'' 中。
/QUserResult.asp,行124
...全文
476打赏收藏
请教大侠!
发生这样的错误应该怎么样改正呢? Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14' [Microsoft][ODBC Microsoft Access Driver] 语法错误 (操作符丢失) 在查询表达式 'AND USERNAME='aa'' 中。 /QUserResult.asp,行124
if cbUserID = "on" then
Conditions = " USERID='" &txtUserID &"' "
HasChoose = 1
end if
if cbUserName = "on" then
Conditions = " USERNAME='" &txtUserName &"' "
if HasChoose = 0 then
HasChoose = 1
else
Conditions = " AND " &Conditions
end if
end if
dim sDsn,sSQL
Set Conn = Server.CreateObject("ADODB.Connection")
sDsn = m_SystemDSN
Conn.Open sDsn
Set rst = Server.CreateObject("ADODB.Recordset")
rst.CursorLocation = 3
rst.CacheSize = 5
sSQL = "SELECT * FROM USERDATA "
dim HasChoose,Conditions
HasChoose = 0
if cbUserID = "on" then
Conditions = " USERID='" &txtUserID &"' "
HasChoose = 1
end if
if cbUserName = "on" then
Conditions = " USERNAME='" &txtUserName &"' "
if HasChoose = 0 then
HasChoose = 1
else
Conditions = " AND " &Conditions
end if
end if
if cbAccountDate = "on" then
Conditions = " OPENDATE >= CDate('" &beginTime &"') AND OPENDATE <= CDate('" &endTime &"') "
if HasChoose = 0 then
HasChoose = 1
else
Conditions = " AND " &Conditions
end if
end if
if HasChoose = 1 then
sSQL = sSQL &" WHERE " &Conditions
end if
rst.Open sSQL,Conn,1,1
if rst.EOF or rst.BOF then
response.write "<p align=center> 没有您所要找的记录! </p>"
response.write "<p align=center><A href=""javascript:history.back(1)"">返回</A></p>"
response.end
end if