Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14'错误如何解决啊!!急!!
今天做登陆校验那块儿,总是提示语法有错误,查了半天没看出来,请高手指导一下!
<!--#include file= "opendb.inc "-->
<%
dim user,password,selstorage
user=request.Form( "username ")
password=request.Form( "password ")
sql= "select * from user where username= ' "&user& " ' " //提示这两行语法错误
sql=sql& " and password= ' "&request( "password ")& " ' " //提示这两行语法错误
rs.open sql,conn,3,2
if rs.eof and rs.bof then
response.write " <SCRIPT language=JavaScript> alert( '错误的用户名或密码,请重新输入! '); "
response.write "javascript:history.go(-1) </SCRIPT> "
else
rs( "isonline ")=True
rs( "login_time ")=now()
rs( "ip ")=Request.ServerVariables( "REMOTE_HOST ")
rs.update
session( "userlogin ")= "true "
'session( "storage ")=selstorage
session( "username ")=user
response.cookies( "guestok ")= "true "
response.cookies( "leader ")=rs( "leader ")
response.cookies( "adminok ")=rs( "manager ")
response.redirect "main.asp "
rs.close
end if
%>
总是出现:Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14 '
[Microsoft][ODBC SQL Server Driver][SQL Server]在关键字 'user ' 附近有语法错误。
/qinghua/loginchk.asp,行 17
原来用ACCESS库就没有问题,后来我导入到SQL库里就出现这问题,请问如何解决,语法错了吗???
[解决办法]
sql= "select * from [user] where username= ' "&user& " ' "
这样看看
[解决办法]
呵呵,估计又是关键字在捣鬼
user可能是sql的关键字,你用 [user] 试试
[解决办法]
明显是应为sql数据库不允许使用user这个关键字来作为表明,你只需要用方括号将user括起来就行了,正如楼上两位所说的