我有一個需要驗證用戶名和密碼的登錄表單 我在訪問表 (sha1) 中對密碼進行了哈希處理 我使用 dlookup 函式查找用戶,但我不知道如何將輸入的密碼與找到的用戶名密碼進行比較
If (IsNull(DLookup("UserName", "UserID", "UserName='" & Me.Userbox.Value & "'")))
我這樣做了,但是當找到用戶名時,我不知道如何參考保存為哈希的密碼,這意味著我想知道如何參考訪問表中的單元格。謝謝你
uj5u.com熱心網友回復:
最好打開一個包含給定用戶的用戶名和密碼的記錄集。如果用戶名不存在,則記錄集將為空。
Dim r As DAO.Recordset
Set r = CurrentDb().OpenRecordset("SELECT UserName, Password FROM UserID WHERE UserName='" & Userbox.Value & "'", dbOpenSnapShot)
If r.EOF Then
'Username does not exist
Exit Sub
End If
'Reaching this point means the username exists.
'Hash the given password and compare it with the one stored in the table.
'The password returned from the recordset can be obtained using r![Password]
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/497026.html
標籤:vba 毫秒访问 哈希 ms-access-2010
