Solved

Error trapping on ASP Oracle connection

Posted on 2002-06-21
4
811 Views
Last Modified: 2008-02-01
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  
0
Comment
Question by:kcsheets
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 20

Accepted Solution

by:
jitganguly earned 50 total points
ID: 7099589
Use on error resume next

on Error Resume Next
' open your connection here
' or execute SQL etc.
' Then trap errors like this

if err.number<> 0 then
  Response.Write "Error in Opening .. and the error is : " & Err.Description
  Response.end
end if


0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7099591
You could try putting this at the top of your page:

<%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 following VB Errors Occured<p>")
     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 > 0 then
    Response.write("<p><hr>The following Connection Errors Occured<p>")
    for iCounter = 0 To objConnection.Errors.Count - 1
          Response.write("Error Number: " & objConnection.errors(iCounter).number & "<br>")
          Response.write("Error Description: " & objConnection.errors(iCounter).description & "<br>")
          Response.write("SQL State: " & objConnection.errors(iCounter).SQLState & "<br>")
          Response.write("Native Error: " & objConnection.errors(iCounter).NativeError & "<br>")
    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
0
 
LVL 5

Expert Comment

by:kcm76
ID: 7100251
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
0
 
LVL 4

Expert Comment

by:Wakie
ID: 9355408
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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Auto Submit on dropdown box 14 78
RegEx Help - open to other simple suggestions 8 63
Obtaining data on ASP 8 36
Designing forms 3 44
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question