Greg Bair
Greg Bair

Reputation: 669

Converting MS Oracle client to Oracle Data Provider - OracleException

I'm converting a product from System.Data.OracleClient to Oracle.DataAccess.Client, and came across a question Here's a snippet of some code:

try
{
    //some db code
}
catch (System.Data.OracleClient.OracleException ex)
{
    if (ex.Code == 00904)
    {
        // log specific error
    }
}

The problem is, Oracle.DataAccess.Client.OracleException has no Code property. It has a Number property. Is this the same thing? The docs say this about the property -

This error number can be the topmost level of error generated by Oracle and can be a provider-specific error number.

The Code property contained the ORA- error code.

Upvotes: 2

Views: 719

Answers (1)

Greg Bair
Greg Bair

Reputation: 669

Yes, they are the same thing. Oracle.DataAccess.Client.OracleException.Number is the same info as System.Data.OracleClient.OracleException.Code.

Upvotes: 2

Related Questions