求高手解答问什么asp运行时会报FROM子句语法错误???代码如下:
<%
Dim username,password
username=replace(trim(request("username")),"'","")
session("username")=username
password=replace(trim(request("password")),"'","")
set rs=Server.CreateObject("adodb.recordset")
rs.Open"select * from user where [username]='" & [username] & "' and [password]='" & [password] & "'" ,conn,1,3 '在user数据库中查找用户
If Not rs.Eof and Not rs.Bof Then '找到用户
response.Cookies(cookiename)("username")=trim(request("username"))
response.Cookies(cookiename)("vip")=rs("vip")
rs("lastvst")=now()
rs("loginnum")=rs("loginnum")+1
rs.Update
rs.Close
set rs=nothing
Response.Redirect "index.asp" '重定向到首页
Else '如果没有记录,表示用户名或密码可能不正确,请给出提示信息
call MsgBox ("对不起,用户名或密码有误!","Back","None")
End If
%>
追问:call MsgBox ("对不起,用户名或密码有误!","Back","None")
这里貌似还有一个错误,报错是类型不匹配。。。求救
答案:rs.Open "select * from [user] where [username]='" & username & "' and [password]='" & password & "'" ,conn,1,3
其他:"select * from user where [username]='" & username & "' and [password]='" & password]& "'" 为什么后面 还加 [ 和] ,去掉。 select * from [user] ********试下。。user是关键字
上一个:ASP.NET如何拆分字符串
下一个:asp.net传值.描叙请看下面!