我的asp连接access数据库验证登录代码哪里错了

来源:百度知道 编辑:UC知道 时间:2024/05/16 09:17:17
很急用,在线等
<body>

<%
dim a,mess
a=hour(now)
if a>=0 and a<12 then
mess="早上好!"
elseif a>=12 and a<18 then
mess="下午好!"
else
mess="晚上好!"
end if
Response.Write(mess)
%>
<%
dim db
set db=server.CreateObject("ADODB.Connection")
db.open "dbq=" & server.mappath("db1.mdb") & ";Driver={microsoft access driver (*.mdb)}"
<!--查询数据-->

dim var_name,var_pass
var_name=Request.Form("name")'获取用户
var_pass=Request.Form("pass")'获取密码

dim strsql,rs
strsql="Select * From user_info where user_name='" & var_name & "'and user_pass='" & var_pass & "'"
set rs=server.CreateObject("adodb.recordset")
rs.open strsql,db,3
if rs.recordcount= 0 then %>
<script language="vbsc

if rs.recordcount= 0 then
替换成
If Not rs.EOF = True Then

代码懒的看,请写报错信息

rs.open strsql,db,3
这段错了 ; 改成这样试试 :
rs.open strasql,db,1,1

帮你修改了
<body>
<%
dim a,mess
a=hour(now)
if a>=0 and a<12 then
mess="早上好!"
elseif a>=12 and a<18 then
mess="下午好!"
else
mess="晚上好!"
end if
Response.Write(mess)
%>
<%
dim db
set db=server.CreateObject("ADODB.Connection")
db.open "dbq=" & server.mappath("db1.mdb") & ";Driver={microsoft access driver (*.mdb)}"
'查询数据
dim var_name,var_pass
var_name=Request.Form("name")'获取用户
var_pass=Request.Form("pass")'获取密码

dim strsql,rs
strsql="Select * From user_info where user_name='" & var_name & "'and user_pass='" & var_pass & "'"
set