Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: ADO error handling

Re: ADO error handling

From: Dimitris Dimolas <dimolas_at_hotmail.com>
Date: Fri, 6 Dec 2002 15:47:15 +0200
Message-ID: <utb803SnCHA.2276@TK2MSFTNGP09>


UNDER EATCH STATEMENT PUT CheckForConnectionError dbConnection

ex.
dbConnection.EXECUTE "SELECT xxx FROM tblName" CheckForConnectionError dbConnection

AN INCLUDE THIS FUNCTION TO YOUR PROJECT. Public Function CheckForConnectionError(conn As ADODB.Connection)

    On Error GoTo 0

        If conn.Errors.Count <> 0 Then
            Err.Raise conn.Errors(0).Number, conn.Errors(0).Source,
conn.Errors(0).Description, conn.Errors(0).HelpFile, conn.Errors(0).HelpContext

        End If
End Function

--
Dimolas Dimitris
Web Developer / Programmer

Athens Greece

"Jimbo" <invalid_at_invalid.spam> wrote in message
news:bkvuuug5ipnvr82q24isedc9nc2d7s0a44_at_4ax.com...

> tojo wrote:
> >In article ... says...
> >>
> >> Can anyone tell me why error handlers not catcthing oracle unique
> >> contraint errors?
>
> [ snips ]
>
> >A unique contraint error is provider-specific, not an ADO error. That
> >means it won't cause a VB runtime error, and your ErrorHandler label
> >will never be reached. You should either:
> >
> >1. Check your dbConnection.Errors collection right after you Execute
>
> How do I access the error when its's actually breaking on the
> dbCommand.Execute. I tried this below but no joy, will it fire some
> event i'm unaware of?
>
> dbCommand.Execute
> MsgBox dbConnection.Errors.Item.Number
>
> I actually want the insert to fail if it causes duplicates, but I
> don't want my program to fall over.
>
> >2. Use the RecordsAffected parameter with Execute to make sure your
> >insert succeeded.
>
> Ok, never used that, sounds handy.
Received on Fri Dec 06 2002 - 07:47:15 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US