X
xfile
Hi:
I am still learning how to do the ASP pages with MS Access.
I have come up a simple logon page with ASP and using included logon.inc
It tests fine so far, but I wish to add an error message if the user enter
an incorrect password.
The following are part of codes of the include file, and can anyone please
tell me where and how can I add an error message to the codes for invalid
password?
Thanks so much...
-----------
' This function checks for a username/password combination.
Function ComparePassword(UID,PWD)
' Define your variables.
Dim strSQL, objCN, objRS
' Set up your SQL string.
strSQL = "SELECT * FROM " & USERS_TABLE & " WHERE (UID='" & UID & "' AND
PWD='" & PWD & "');"
' Create a database connection object.
Set objCN = Server.CreateObject("ADODB.Connection")
' Open the database connection object.
objCN.Open "driver={Microsoft Access Driver (*.mdb)}; dbq=" &
Server.MapPath(MDB_URL) & "; uid=admin; pwd="
' Run the database query.
Set objRS = objCN.Execute(strSQL)
' Set the status to true/false for the database lookup.
ComparePassword = Not(objRS.EOF)
' Close your database objects.
Set objRS = Nothing
Set objCN = Nothing
End Function
------------------------------------------
I am still learning how to do the ASP pages with MS Access.
I have come up a simple logon page with ASP and using included logon.inc
It tests fine so far, but I wish to add an error message if the user enter
an incorrect password.
The following are part of codes of the include file, and can anyone please
tell me where and how can I add an error message to the codes for invalid
password?
Thanks so much...
-----------
' This function checks for a username/password combination.
Function ComparePassword(UID,PWD)
' Define your variables.
Dim strSQL, objCN, objRS
' Set up your SQL string.
strSQL = "SELECT * FROM " & USERS_TABLE & " WHERE (UID='" & UID & "' AND
PWD='" & PWD & "');"
' Create a database connection object.
Set objCN = Server.CreateObject("ADODB.Connection")
' Open the database connection object.
objCN.Open "driver={Microsoft Access Driver (*.mdb)}; dbq=" &
Server.MapPath(MDB_URL) & "; uid=admin; pwd="
' Run the database query.
Set objRS = objCN.Execute(strSQL)
' Set the status to true/false for the database lookup.
ComparePassword = Not(objRS.EOF)
' Close your database objects.
Set objRS = Nothing
Set objCN = Nothing
End Function
------------------------------------------