|
 |
asp_databases thread: Error Trapping on Connection Open command
Message #1 by "Kim Sheets" <kim.sheets@e...> on Fri, 21 Jun 2002 22:11:37
|
|
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:
set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open ODBCDSN, dbuser, dbpass
How do trap this error and redisplay my entry screen with the appropriate
message?
Thanks.
KC
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 24 Jun 2002 13:20:11 +1000
|
|
There are lots of options :-)
VBScript has an inbuilt Error object that you can use:
<%
On Error Resume Next
' Attempt to open connection
If Err.Number <> 0 then
' Error occured
End If
On Error Goto 0
%>
The ADO Connection object has a built in Errors collection you can use as
well:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
mdcolerrors.asp
Alternatively, if you have IIS v5, you can use the built-in ASPError object
(using .GetLastError) to handle all 500 errors (look at the custom
500-100.asp error handler that is supplied with IIS to see how it all
works - you just create your own .asp page with similar code)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Kim Sheets" <kim.sheets@e...>
To: "ASP Databases" <asp_databases@p...>
Sent: Friday, June 21, 2002 10:11 PM
Subject: [asp_databases] Error Trapping on Connection Open command
: 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:
:
: set DBConn = Server.CreateObject("ADODB.Connection")
: DBConn.Open ODBCDSN, dbuser, dbpass
:
: How do trap this error and redisplay my entry screen with the appropriate
: message?
:
: Thanks.
:
: KC
|
|
 |