Error Handling

D

David N.

Hi All,

I have the following Net.VBScript:

Set oConnection = CreateObject("adodb.connection")
Set oRecord = CreateObject("adodb.RecordSet")
Set oError = CreateObject("adodb.Error")
oConnection.Open
On Error Resume Next
Set oRecord = oConnection.Execute("TestProcedure")
DisplayErrorInfo()
....
.....
.....
Sub DisplayErrorInfo
MsgBox "Before Loop"

For Each oError in oRecord.ActiveConnection.Errors
MsgBox "Description: " & oError.Description
Next

MsgBox "After Loop"
End

The stored procedure TestProcedure always raises an error at the end (for
testing purpose). I can see that the error is caught by the above VB
script, and the messages "Before Loop" and "After Loop" are displayed.
However, the execution never goes into the for/next loop.

How do I get the error message that is raised by the stored procedure?

Thanks
 
H

Herfried K. Wagner [MVP]

* " David N. said:
I have the following Net.VBScript:

Set oConnection = CreateObject("adodb.connection")
Set oRecord = CreateObject("adodb.RecordSet")
Set oError = CreateObject("adodb.Error")

That's not VB.NET code. I suggest to turn to one of the scripting
groups:

<URL:<URL:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top