error checking

Results 1 to 2 of 2

Thread: error checking

  1. #1
    Join Date
    Dec 1969

    Default error checking

    How do I check to see if a sql on asp page fails to connect<BR>to an oracle database. So I can redirect to another page.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: error checking

    Well, that depends on what you are trying to do.<BR><BR>If you just want to see if you connection was made, then try this.<BR>&#060;%<BR>On Error Resume Next<BR>&nbsp;Dim cnn<BR>&nbsp;Set cnn = Server.CreateObject("ADODB.Connection")<BR>&nbsp;c nn.Open("DSN=MyDSN;UID=MyUser;PWD=pwd;")<BR>If cnn.State = 0 then<BR>&nbsp;&nbsp;&#039;0 = closed<BR>&nbsp;&nbsp;DoSomething(withOrWithoutPar ams)<BR>Else<BR>&nbsp;&nbsp;&#039;1 = open<BR>&nbsp;&nbsp;DoSomethingElse(withOrWithoutP arams)<BR>End If<BR>%&#062;<BR><BR><BR>If you want to see the errors then...<BR>&#060;%<BR>&nbsp;&#039;This will write out any errors or corrections that the &nbsp;Connection has made. All of these may not be errors though. <BR>For x = 0 to cnn.Errors.Count<BR>&nbsp;&nbsp;Response.Write x & ":" & cnn.Errors.Item(x) & "&#060; BR &#062;"<BR>next<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts