kcsheets
asked on
Error trapping on ASP Oracle connection
Currently I have an application with a signon screen where the user inputs logon id and password. I then validate this against an Oracle table entry. There is one Oracle ID and password assigned to my app. Now the DBA is creating an Oracle id and password that matches each of my user id and passwords. This works fine as long as the userid and password are correct. However, when either the id or password are wrong I get:
Microsoft OLE DB Provider for ODBC Drivers error '80040e4d'
[Microsoft][ODBC driver for Oracle][Oracle]ORA-01017: invalid username/password; logon denied
I am getting the error on the connection open command. How do trap this error and redisplay my entry screen with the appropriate message?
Thanks.
KC
Microsoft OLE DB Provider for ODBC Drivers error '80040e4d'
[Microsoft][ODBC driver for Oracle][Oracle]ORA-01017: invalid username/password; logon denied
I am getting the error on the connection open command. How do trap this error and redisplay my entry screen with the appropriate message?
Thanks.
KC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
using the Err.Number value as querystring to the redirection ASP page as a querystring. Using Select Case statement u can give proper error messages.
main page:
IF Err.Number > 0 then
response.Redirect "login.asp?Num=" + err.Number
end if
***login.Asp***
Dim varErrorNumber
varErrorNumber = Request.QueryString
Select case varErrorNumber
case "80040e4d"
Response.Write "Invalid UserId/Password"
End Select
main page:
IF Err.Number > 0 then
response.Redirect "login.asp?Num=" + err.Number
end if
***login.Asp***
Dim varErrorNumber
varErrorNumber = Request.QueryString
Select case varErrorNumber
case "80040e4d"
Response.Write "Invalid UserId/Password"
End Select
It appears this question has been abandoned.
I will leave a recommendation in the Cleanup topic area that this question will be:
- Points to jitganguly -
Please leave any comments here within the next seven days.
DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Wakie,
EE Cleanup Volunteer.
I will leave a recommendation in the Cleanup topic area that this question will be:
- Points to jitganguly -
Please leave any comments here within the next seven days.
DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Wakie,
EE Cleanup Volunteer.
<%On Error Resume Next%>
and then you can use code such as this to trap errors:
'VBScript errors
If Err.Number > 0 Then
Response.write("<p><hr>The
Response.write("Error Number: " & Err.number & "<br>")
Response.write("Error Source: " & Err.source & "<br>")
Response.write("Error Description: " & Err.description & "<br>")
End If
'Connection errors
dim iCounter
if objConnection.Errors.count
Response.write("<p><hr>The
for iCounter = 0 To objConnection.Errors.Count
Response.write("Error Number: " & objConnection.errors(iCoun
Response.write("Error Description: " & objConnection.errors(iCoun
Response.write("SQL State: " & objConnection.errors(iCoun
Response.write("Native Error: " & objConnection.errors(iCoun
next
end if
In your case, of course, you would not want to print the errors, but rather use conditional logic such that if there were connection errors, you would print an appropriate message for the user.
Fritz the Blank