展开全部
<% dim conn dim connstr 'on error resume next call conn_init() sub conn_init() 'on error resume next connstr = "DBQ=" + server.mappath("数据库名称.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" set conn=server.createobject("ADODB.CONNECTION") if err.number<>0 then err.clear set conn=nothing response.write "数据库连接出错!" Response.End else conn.open connstr if err then err.clear set conn=nothing response.write "数据库连接出错!" Response.End end if end if end sub sub endConnection() conn.close set conn=nothing end sub %> <% dim rs,sql set rs = server.createobject("adodb.recordset") sql="select * from ADMIN where id='" & Request.Form("usname") & "' and pss='" & Request.Form("no") & "'" rs.open sql,conn,1,1 if err.number<>0 then response.write "数据库操作失败:"&err.description else if rs.bof and rs.eof then response.write "<center><FONT color=red face=宋体 size=5>对不起,请输入正确的用户名和密码。</font></center>" rs.close else rs.close session("studentname")=request.form("usname") session("studentpassword")=request.form("no") set rs=nothing call endConnection() Response.Redirect "home.asp" end if %> <HTML> <HEAD> <META NAME="hello" > <meta http-equiv="Content-Type" content="text/html; charset=gb2312"></HEAD> <BODY > <table width="75%" border="0" align="center" height="464"> <tr> <td height="420"> <FORM action="index.asp" method=post id=form name=form> <P align=center><FONT color=green face=华文行楷 size=6>欢迎登陆</FONT></P> <P align=center>姓名 <INPUT id=1 name=usname> </P> <P align=center>密码 <INPUT id=2 name=no type="password"> </P> <P align=center> <INPUT id=submit1 name=submit type=submit value="登 录"> </P> </FORM> </td> </tr> </table> </BODY> </HTML> --------------------------------------------------------- 这是网页的登录页代码 一些东西自己修改完善
希望采纳
希望采纳
快又稳
2024-10-28 广告
2024-10-28 广告
数据库服务器作为广州快又稳网络科技有限公司的核心基础设施之一,承载着公司海量数据的存储、处理与访问需求。我们采用高性能、高可用性的服务器架构,确保数据的安全性、完整性和快速响应能力。通过先进的数据库管理系统,优化查询效率,支持复杂业务场景下...
点击进入详情页
本回答由快又稳提供
展开全部
<% dim conn dim connstr 'on error resume next call conn_init() sub conn_init() 'on error resume next connstr = "DBQ=" + server.mappath("数据库名称.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" set conn=server.createobject("ADODB.CONNECTION") if err.number<>0 then err.clear set conn=nothing response.write "数据库连接出错!" Response.End else conn.open connstr if err then err.clear set conn=nothing response.write "数据库连接出错!" Response.End end if end if end sub sub endConnection() conn.close set conn=nothing end sub %> <% dim rs,sql set rs = server.createobject("adodb.recordset") sql="select * from ADMIN where id='" & Request.Form("usname") & "' and pss='" & Request.Form("no") & "'" rs.open sql,conn,1,1 if err.number<>0 then response.write "数据库操作失败:"&err.description else if rs.bof and rs.eof then response.write "<center><FONT color=red face=宋体 size=5>对不起,请输入正确的用户名和密码。</font></center>" rs.close else rs.close session("studentname")=request.form("usname") session("studentpassword")=request.form("no") set rs=nothing call endConnection() Response.Redirect "home.asp" end if %> <HTML> <HEAD> <META NAME="hello" > <meta http-equiv="Content-Type" content="text/html; charset=gb2312"></HEAD> <BODY > <table width="75%" border="0" align="center" height="464"> <tr> <td height="420"> <FORM action="index.asp" method=post id=form name=form> <P align=center><FONT color=green face=华文行楷 size=6>欢迎登陆</FONT></P> <P align=center>姓名 <INPUT id=1 name=usname> </P> <P align=center>密码 <INPUT id=2 name=no type="password"> </P> <P align=center> <INPUT id=submit1 name=submit type=submit value="登 录"> </P> </FORM> </td> </tr> </table> </BODY> </HTML> --------------------------------------------------------- 这是网页的登录页代码 一些东西自己修改完善
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询