Asp 单页查询数据库

时间:2010-05-11 20:11:00 

 

<!-- #include file="../conn.asp" -->
<%
dim rs,sql,x_name,x_pwd,x_count
If Request.Form("do")="ok" Then
If Request.Form("user_name")="" Then
Response.Write("<script Language='javascript'>alert('对不起,请输入用户名!\t');history.go(-1);</script>")
Response.End()
Else
x_name = Request.Form("user_name")
End If
'↑ 叛断用户名是否为空!
If Request.Form("user_pwd")="" Then
Response.Write("<script Language='javascript'>alert('对不起,请输入用户密码!\t');history.go(-1);</script>")
Response.End()
Else
x_pwd = Request.Form("user_pwd")
End If
'↑ 叛断用户密码是否为空!
set rs = Server.Createobject("adodb.recordset")
sql="select * from [user] where user_name='"&x_name&"' and user_pwd='"&x_pwd&"'"
rs.open sql,conn,1,1
if not rs.Eof Then
session("s_name")=rs("user_name")
session("s_shen")=rs("shenfen")
session("s_shi")=rs("shijian")
Response.Redirect "infoin.asp"
Else
Response.Write("<script language='javascript'>alert('对不起,用户或密码错误!\t');history.go(-1);</script>")
Response.End()
End If
Else
%>
<title>--&gt;系统登录</title>
<style type="text/css">
<!--
.zi {
 font-family: Arial, Helvetica, sans-serif;
 font-size: 10pt;
}
-->
</style>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p> &nbsp; </p>
<p>&nbsp;</p>   
   
 <table width="320" height="140" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#33CCFF" class="zi">
  <tr>
    <td colspan="2">--&gt;系统登录</td>
   </tr>
   <form name="form1" method="post" action="index.asp">
  <tr bgcolor="#FFFFFF">
    <td width="72"><div align="center">帐号:</div></td>
    <td width="239">
      <input name="user_name" type="text" id="user_name">
    </td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td><div align="center">密码:</div></td>
    <td><input name="user_pwd" type="password" id="user_pwd"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="登 录">
      <input type="button" name="Submit" value="关 闭" onClick="window.close()">
      <input name="do" type="hidden" id="do" value="ok"></td>
  </tr>
  </form>
  <tr>
    <td colspan="2"><div align="right">v1.00</div></td>
   </tr>
</table>
<%End If%>

标签:数据库,查询
0
投稿

猜你喜欢

  • 利用django如何解析用户上传的excel文件

    2022-04-04 04:45:20
  • 如何在CocosCreator中做一个List

    2024-04-28 09:46:04
  • Python使用海龟绘图实现贪吃蛇游戏

    2022-01-03 15:21:28
  • python版本单链表实现代码

    2022-12-06 16:49:26
  • 使用python对多个txt文件中的数据进行筛选的方法

    2022-02-19 10:09:30
  • javascript移动设备Web开发中对touch事件的封装实例

    2024-04-26 17:13:17
  • Yii使用find findAll查找出指定字段的实现方法

    2024-05-03 15:13:37
  • python语言元素知识点详解

    2023-07-30 03:33:08
  • python实现线性回归算法

    2021-04-11 12:36:48
  • 老生常谈Python startswith()函数与endswith函数

    2023-06-03 02:02:42
  • Python检查 云备份进程是否正常运行代码实例

    2023-07-08 23:59:05
  • python 读写excel文件操作示例【附源码下载】

    2023-02-20 09:26:31
  • VUE跨域详解以及常用解决跨域的方法

    2024-06-07 16:04:29
  • Python 2.7中文显示与处理方法

    2021-06-14 16:07:39
  • MySQL数据库中对前端和后台进行系统优化

    2009-01-04 13:39:00
  • javascript双击自动滚屏单击停止

    2008-10-13 13:05:00
  • pandas 使用merge实现百倍加速的操作

    2022-06-11 08:22:28
  • Python 代码实现各种酷炫功能

    2022-12-24 10:40:16
  • Google的产品设计指导思想

    2008-03-23 14:15:00
  • Python实现抓取HTML网页并以PDF文件形式保存的方法

    2022-12-15 22:56:30
  • asp之家 网络编程 m.aspxhome.com