为什么会出现这个错误呢?

iWebCoder 2014-10-30 06:01:45
Microsoft JET Database Engine 错误 '80040e14'

FROM 子句语法错误。

/check.asp,行 19
objRS.Open strSQL,objConn,1,3
-------------------------------------------------------------------------------------------------
<%
Dim Uname,Upwd
Uname=Trim(Request.Form("username"))
Upwd=Trim(Request.Form("password"))

If Uname="" or Upwd="" Then
Response.Redirect("login.asp?errMsg=请完整填写表格!")
Response.End()
End if

Dim objConn,strSQL,objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Dim connStr
connStr="Provider=Microsoft.JET.OLEDB.4.0;Data Source="&Server.MapPath("db/vote.mdb")&";"
objConn.Open connStr
strSQL="select * from User where Username='"&Uname&"'"
strSQL=strSQL & "and Password='"&Upwd&"'"
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL,objConn,1,3
If objRS.Eof Then
Response.Redirect("login.asp?errMsg=用户名或密码错误!")
Response.End()
Else
Session("Id")=CStr(objRS.Fields("id"))
Session("Name")=Uname
Session("Class")=objRS.fields("class")
Session("isPwd")=True
If objRS.Fields("class")="1" Or objRS.Fields("class")="2" Then
Session("isAdmin")=True
Else
Session("isAdmin")=False
End If
If Request.Form("RemMe")="1" Then
Response.Cookies("Name")=Uname
Response.Cookies("Pwd")=Upwd
Response.Cookies("isAdmin")=1
Response.Cookies("Name").Expires=Date+365
Response.Cookies("Pwd").Expires=Date+365
Response.Cookies("RemMe").Expires=Date+365
End If
End If
objRS.Close
Set objRS=Nothing
objConn.Close
Set objConn=Nothing
Response.Redirect("index.asp")
Response.End()
%>
...全文
222 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿良良木月火 2014-10-31
  • 打赏
  • 举报
回复
关键字问题,格式要正确
三楼の郎 2014-10-30
  • 打赏
  • 举报
回复
strSQL="select * from [User] where [Username]='" & Uname & "'" strSQL=strSQL & " and [Password]='" & Upwd & "'"
save4me 2014-10-30
  • 打赏
  • 举报
回复
下面这句的and之前加上一个空格

strSQL=strSQL & "and Password='"&Upwd&"'"

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧