<%
' Instruct the Err object to ignore errors and continue to process and reset the Err object
On Error Resume Next
' Connect to the Database
MyDSN = "DSN=inet;UID=sa;PWD=qis"
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open MyDSN
' Open a Recordset
Set loginRs = Server.CreateObject("ADODB.Recordset")
sqlStr = "SELECT userId, userName, creditLimit FROM users " & _
"WHERE userId = '" & Request.Form(userId) & "'"
loginRs.Open sqlStr, MyConn, 3
' Check whether required data exists, and
' if exists, read the data into Variables
IF loginRs.RecordCount = 1 THEN
userId = loginRs("userId")
userName = loginRs("userName")
creditLimit = loginRs("creditLimit")
ELSE
userId = ""
END IF
' Close the Recordset and the Database Connection
loginRs.Close
MyConn.Close
' Check if there was any error,
' if so, display a friendly error message.
' else display the information they requested.
IF Err.Number <> 0 THEN
Response.Write "Sorry, due to technical problems, I cannot process your request now."
Response.Write " Error " & "has occurred. Please contact dbstar.com with exact web page name and error number for technical assistance."
ELSE
' Display the Information to the Visitor if the data was retrieved
END IF
' Disable Error Handling
On Error goto 0
%>
|