<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/> <title>检验登录</title> </head> <body> <% username=request.Form("username") password=request.Form("userpwd") '以下连接数据库,建立一个Connection对象实例db Dim db Set db=Server.CreateObject("ADODB.Connection") db.Open "Dbq="&Server.Mappath("data.mdb")&";Driver={Microsoft Access Driver (*.mdb)}" //查询SQL语句 strSql="Select * From user where username='"&username&"'and userpwd='"&password&"'" set rs=db.execute(strsql) if rs.eof then response.Write "错误的用户名或密码" else'成功 session("un")=username //存入session,以后页面判断权限调用 session("up")=password response.Redirect("index.asp")//重定向到 首页 endif set rs=nothing %> </body> </html>