Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ADO error handling
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...Received on Fri Dec 06 2002 - 07:47:15 CST
> 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.
![]() |
![]() |