日期:2014-05-17  浏览次数:21027 次

求一个调用数据库的登录界面,
求一个调用数据库的登录界面,数据库里有登录的密码,姓名,数据库名为a.dmb,表里密码名为mm,姓名为xm,我刚学asp,有会的编个代码借鉴下

------解决方案--------------------
1、先在登录页 login.asp 上放个表单接收用户输入的用户名和密码
主要代码:
<table width="300" border="0" id="table11">
<form action="checklogin.asp" method="post" name="form1" id="form1">
<tr>
<td width="197" height="30" align="right">用户名:</td>
<td width="205" height="30">
<input name="username" type="text" class="button1" id="username" onFocus="this.select()" onMouseOver="this.focus();" value="admin" size="20" maxlength="20"></td>
</tr>
<tr>
<td height="30" align="right">密&nbsp;码:</td>
<td height="30"><input name="userpass" type="password" class="button1" id="userpass" onFocus="this.select()" onMouseOver="this.focus();" value="123456" size="21" maxlength="20"></td>
</tr>
<td align="right"> </td>
<td> </td>
<td height="30"></td>
<tr align="center">
<td height="30" colspan="2"><label>
<input type="submit" name="Submit" value="登 录" />  
<input type="reset" name="Submit2" value="取 消" />
</label></td>
</tr></form> 
2、检查登录信息checklogin.asp

<% username=Trim(Request("username"))
userpass=Trim(Request("userpass"))

set rs= Server.CreateObject("adodb.recordset") 
sql="select * from usertable where username='"&username&"' and password='"&userpassword&"'"
rs.open sql,conn,1,1

if not rs.eof then 
session("username")=username
session("userid")=rs(0)
session("uid")=rs(0)
session("leader")=rs(3)
response.Redirect("index0.asp")
'?a1="&username&"&a2="&rs(0)&"&a3="&rs(3))
else
response.Redirect("login.asp")
end if

%>
------解决方案--------------------
自己去搜索引擎上找找
------解决方案--------------------
就是 这些代码网上遍地都是...
------解决方案--------------------
asp一般的做法,就是独立一个文件用来配置数据库,。 如Getcon.asp
 自己去网上找一下ASP连接access的方法,。或直接下载,。
然后在需要的地方引用,<!--#include file="Getcon.asp"-->

这样就可以直接用Connection对象了, 
 像2楼的 rs.open sql,conn,1,1
这个conn 就是了,。
------解决方案--------------------
探讨

二楼的高手,我看了你的代码,没有发现和数据库关联的代码,不用调用数据库吗