Help with understanding Errors collection: DAO/ODBCDirect/Oracle8 
Author Message
 Help with understanding Errors collection: DAO/ODBCDirect/Oracle8

I have a VB6 SP3 app under NT4.0 SP5 using DAO/ODBCDirect to connect to the
Microsoft Oracle driver (which in turn accesses Oracle8 over a Net8
"service")

Works fine, but under some valid error conditions*  the DBEngine.Errors
collection doesn't make sense.

* like failing to supply a value for a required database field - I suspect -
but then I can't be sure because I'm not getting the error messages
correctly!

My error handling code is...

    For Each errObj In DBEngine.Errors
        With errObj
                   Select Case .Number
                    ... etc

If I break at the Select Case .Number and use Watch to look at the
DBEngine.Errors collection, I see something like:

        Count        1
    Item 1
        Number    3001

But if I look at errObj, I see:

        Number    3251

So, which is it...3001 or 3251?   Do I have two Errors or one?  If two, then
why is the collection item count only 1?   Is there something asynchronous
going on here ? (my OpenRecordset is not async).

Here's the code that triggers the error...

            Dim ws as Workspace
            Dim cn as Connection
            Dim rs as Recordset

            On Error Goto TrapErr

            Set ws = DBEngine.CreateWorkspace("ODBCWorkspace", "", "",
dbUseODBC)

            Set cn = ws.OpenConnection("ODBCConnection", dbDriverComplete +
dbDriverNoPrompt + dbRunAsync, False, strConn)

            s = "SELECT ..."
            Set rs = cn.OpenRecordset(s, dbOpenDynaset, dbExecDirect,
dbOptimistic)
            rs.AddNew
            rs("field1") = "xxx"
            rs.Update
            rs.Close
            Set rs = Nothing

TrapErr:
            For Each errObj In DBEngine.Errors
                With errObj
                       Select Case .Number
                            ... etc

Any insights would be appreciated!

David Thom



Fri, 26 Apr 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Help with understanding Errors collection: DAO/ODBCDirect/Oracle8

2. Client Cursor error 21 - which field in error? (DAO/ODBCDirect/Oracle8)

3. DAO/ODBCDirect vs. DAO

4. DAO 3.5 ODBCDirect and stored procs help

5. DAO 3.5 ODBCDirect and stored procs help

6. Example code: Replication between Personal Oracle8 and Oracle8 Server

7. Example code: Replication between Personal Oracle8 and Oracle8 Server

8. Clearing DAO error collection

9. How to: return DAO/ODBCDirect recordset/array from Oracle8 function?

10. How to: return DAO/ODBCDirect recordset/array from Oracle8 function?

11. DAO's ODBCDirect and SQL Server

12. Q: DAO 3.5 w/ODBCDirect call Oracle SP w/Output Params

 

 
Powered by phpBB® Forum Software