急!这样写有什么错误(用户登录)

来源:百度知道 编辑:UC知道 时间:2024/05/14 18:51:06
Dim UserName,password
UserName=replace(trim(Request.Form1("Username")),"'","‘")
password=replace(trim(Request.Form1("password")),"'","‘")

If UserName="" or password="" Then
Response.Write ("<script>alert(' 会员登陆失败!\n\n 请输入用户名和密码。');history.back();</script>")
Response.end
End If

set rs=server.createobject("adodb.recordset")
conn="DBQ="+server.mappath("data.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
sql="select password from user where username='"&UserName&"' and lockuser=0"
rs.open sql,conn,1,3
if rs.eof then
Response.Write ("<script>alert(' 会员登陆失败!\n\n 用户名不存在。');history.back();</script>")
Response.end
else
if rs("password")<>pass

conn="DBQ="+server.mappath("data.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
你只有数据库参数没有连接参数。

正确的答案是:
set conn=server.createobject("adodb.connection")
connstr="DBQ="+server.mappath("data.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
conn.open connstr

出现什么错误?根据错误提示改嘛?或者把他帖出来