asp+access用户登录代码,其中
huiyuan.mdb数据库名
pUser213表名
y_username用户名字段,y_password密码字段.
login.htm页面
<head>
<metahttp-equiv=Content-Typecontent=text/html;charset=gb2312>
<title>登录</title>
</head>
<body>
<p></p>
<formname=form1method=postaction=loginnew.asp>
<tablewidth=200border=1align=centercellpadding=0cellspacing=0>
<tr>
<tdcolspan=2><divalign=center>登录</div></td>
</tr>
<tr>
<tdwidth=57><divalign=center>用户名</div></td>
<tdwidth=137valign=top><inputname=usernametype=text
id=usernamesize=25></td>
</tr>
<tr>
<td><divalign=center>密码</div></td>
<tdvalign=top><inputname=passwordtype=password
id=passwordsize=25></td>
</tr>
<tr>
<tdcolspan=2><divalign=center>
<inputtype=submitname=Submitvalue=提交>
</div></td>
</tr>
</table>
</form>
</body>
</html>
loginnew.asp网页
<%
dimusername,password
username=request.form(username)
password=request.form(password)
setrs=server.createobject(adodb.recordset)
conn=DBQ=+server.mappath(huiyuan.mdb)+;DefaultDir=;
DRIVER={MicrosoftAccessDriver(*.mdb)};
sql=select*frompUser213wherey_username='&username&'
rs.opensql,conn,1,1
ifrs.eofthen
response.write<script>alert('登录失败');history.back();</script>
response.end
else
ifrs(y_password)<>passwordthen
response.write<script>alert('登录失败');history.back();</script>
response.end
endif
session(admin)=username
response.write<script>alert('登录成功');location.href='index.asp'</script>
endif
%>