My Err does not like to work the way it should - H

Results 1 to 2 of 2

Thread: My Err does not like to work the way it should - H

  1. #1
    Join Date
    Dec 1969

    Default My Err does not like to work the way it should - H

    So I followed the advice from<BR><BR>and decided to have all ADO related errors emailed to me<BR>I added the lines<BR>If Err.Number &#060;&#062; 0 Then<BR> bolErrors = True<BR> TrapError Err.Description<BR>end if<BR>(TrapError is a subroutine, check the article for more information)<BR>after all my and conn.execute calls.<BR><BR>Then I delibrately renamed the database my object &#039;conn&#039; was connecting to, in order to generate an error to test. But, nothing!!!<BR>My boolean variable that is to be toggled when their is an error does not toggle so that tells me that the if Err.Number statement is not picking up anything. The script does not present the nice "There was an error and it has been email to technical support." message, but instead continues as if there is no error (because of the On Error Resume Next).<BR><BR>Does anyone know of possible reasons why this is not happening?<BR>The code looks like it will work, and most of it comes right out of that article.<BR><BR>Thanks for your help!!!! :)<BR>-Nic

  2. #2
    Join Date
    Dec 1969

    Default Many DB errors don't appear in Err...

    To find DB errors, you often have to look in the ADODB.Connection.Errors collection.<BR><BR>You can do that thus:<BR><BR>&#060;%<BR>On Error Resume Next<BR>myConn.Errors.Clear<BR>... do the DB operation that might cause error...<BR>On Error GoTo 0 &#039; only "trap" errors where you *need* to!<BR><BR>For Each oops In myConn.Errors<BR>&nbps; &nbsp; Response.Write "DB Error #" & oops.Number & ": " & oops.Description & "&#060;BR/&#062;"<BR>Next<BR>...<BR>%&#062;<BR><BR>Since some of the "oops" you will get from that are only *warnings* and not true errors, you need to filter only for error numbers that you don&#039;t know how to handle.<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