當前位置:編程學習大全網 - 網站源碼 - 怎樣在壹個頁面中通過ASP輸入用戶名和密碼讀取SQL數據庫

怎樣在壹個頁面中通過ASP輸入用戶名和密碼讀取SQL數據庫

妳需要用action=""來定義表單,這樣就會提交到本身頁面,再在本頁面開頭判斷是否有參數輸入,代碼如下:

<!--#include virtual="Conn.asp"-->

If Request("username")<>"" Then

username=Request("username")

password=Request("password")

Set rs=server.createobject("adodb.recordset")

SQL_Text="select * from table where username='"&username&"' and password='"&password&"'"

rs.Open SQL_Text,Conn,3,3

If Not(rs.Eof and rs.Bof) Then

Response.Redirect("error.asp")

End If

rs.Close

Set rs = Nothing

End If

%>

<form action="" method="post">

<input type="text" name="username" value="">

<input type="password" name="password" value="">

<input type="submit" value="提交">

</form>

  • 上一篇:Html木馬源代碼
  • 下一篇:用Maxthon的時候,網頁中圖片問題
  • copyright 2024編程學習大全網