tags:

views:

26

answers:

1

This relates to my recent question: http://stackoverflow.com/questions/2835663/force-oracle-error-on-fetch

I am now able to reproduce a scenario where using ADO with the Oracle OLEDB Provider, I can force an error such as ORA-01722: invalid number to occur on calling Recordset.MoveNext However, this is not the error that is returned to the application. Instead, the application sees Provider error '80004005' Unspecified error. How can I get the application to see the real error from the database? This is with Oracle 10g (client and server), if it matters.

Sample code is roughly as follows:

Dim con As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As ADODB.Recordset

con.ConnectionString = "Provider=OraOLEDB.ORACLE;Data Source=xxx;User Id=yyy;Password=zzz"
con.CursorLocation = adUseServer
con.Open
Set cmd.ActiveConnection = con
cmd.CommandText = "select * from table(ret_err)"
cmd.Prepared = True
Set rs = cmd.Execute
While Not rs.EOF
  rs.MoveNext
Wend
A: 

SQLCODE and SQLERRM should be returned with an SQL call. It looks like ADO Error is the interface for accessing this.

Gary
It doesn't work in the obvious case. The `Errors` collection only contains one element and that one element has a Description of "Unspecified Error". Is there another trick?
Dan