| |
<%
If Request("id") = Empty Then '這行是用來判別使用者是否為送出資料的狀態,如果否,就顯示這個表單
%>
<%
Else '這行是已知道使用者是送出資料的狀態,而進行資料檢察
%>
<%
id = Request("id")
pwd = Request("pwd")
If id = "" or pwd = "" Then
'ShowMessage = "欄位留白不接受!"
%>
<%
Else
' 建立 Connection 物件
Set conn = Server.CreateObject("ADODB.Connection") '建立Connection物件
'========================================================
' 資料庫位置
'========================================================
Driver = "Provider=SQLOLEDB;Data Source=BIZ;"
DBPath = "Initial Catalog=mis;User Id=misDB;Password=bdsim"
' 連結資料庫
conn.Open Driver & DBPath
Set rs = Server.CreateObject("ADODB.Recordset")
'=====================================================
' SQL語法要修改
'=====================================================
rs.Open "Select * From id where 姓名='" & id & "' and 部門='"& pwd &"'", conn, 1, 3
if rs.EOF then '判斷是否過了最後一筆,如果為是則跳出迴圈
'ShowMessage = "帳號或密碼錯誤!"
%>
<%
else
'===================================================
' 當密碼輸入正確時所執行的網頁
'===================================================
'Response.Redirect "list.asp"
%>
<%
end if
End If
End If
%>
<TOP>
|
|