Object reference error when using OleDbCommand object

S

Sunil Menon

Dear All,
We have created a WinForm application that uses OLEDB to connect to
Oracle DB. The Oracle client version is 8.1.6 and the Oracle DB version
is 10g...sometimes we randomly get errors like <Object reference error>
<Unable to retrieve error text for [0]>
The following are the stack strace information...
InnerException: Unable to retrieve error text for [0]
Stack Trace: at System.Data.OleDb.OleDbCommand.ProcessResults(Int32
hr)
at System.Data.OleDb.OleDbCommand.InitializeCommand(CommandBehavior
behavior, Boolean throwifnotsupported)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at itbAS.Foundation.SQLHandle.ExecuteNonQuery(String sql)
Source: OraOLEDB
Extra Information:
Unable to retrieve error text for [0]

Or sometimes we get this error...
InnerException: Object reference not set to an instance of an object.
Stack Trace: at System.Data.Common.ICommandText.SetCommandText(Guid
rguidDialect, String pwszCommand)
at System.Data.OleDb.OleDbCommand.InitializeCommand(CommandBehavior
behavior, Boolean throwifnotsupported)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at itbAS.Foundation.SQLHandle.ExecuteNonQuery(String sql)
Source: System.Data
Extra Information:
Object reference not set to an instance of an object.

It mostly fails at this query...
ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD hh24:mi:ss'

Is this the problem with the OLEDB driver? Or...

Please help...

Thanks & regards
Sunil
 
P

Paul Clement

¤ Dear All,
¤ We have created a WinForm application that uses OLEDB to connect to
¤ Oracle DB. The Oracle client version is 8.1.6 and the Oracle DB version
¤ is 10g...sometimes we randomly get errors like <Object reference error>
¤ <Unable to retrieve error text for [0]>
¤ The following are the stack strace information...
¤ InnerException: Unable to retrieve error text for [0]
¤ Stack Trace: at System.Data.OleDb.OleDbCommand.ProcessResults(Int32
¤ hr)
¤ at System.Data.OleDb.OleDbCommand.InitializeCommand(CommandBehavior
¤ behavior, Boolean throwifnotsupported)
¤ at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
¤ behavior, Object& executeResult)
¤ at
¤ System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
¤ behavior, String method)
¤ at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
¤ at itbAS.Foundation.SQLHandle.ExecuteNonQuery(String sql)
¤ Source: OraOLEDB
¤ Extra Information:
¤ Unable to retrieve error text for [0]
¤
¤ Or sometimes we get this error...
¤ InnerException: Object reference not set to an instance of an object.
¤ Stack Trace: at System.Data.Common.ICommandText.SetCommandText(Guid
¤ rguidDialect, String pwszCommand)
¤ at System.Data.OleDb.OleDbCommand.InitializeCommand(CommandBehavior
¤ behavior, Boolean throwifnotsupported)
¤ at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
¤ behavior, Object& executeResult)
¤ at
¤ System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
¤ behavior, String method)
¤ at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
¤ at itbAS.Foundation.SQLHandle.ExecuteNonQuery(String sql)
¤ Source: System.Data
¤ Extra Information:
¤ Object reference not set to an instance of an object.
¤
¤ It mostly fails at this query...
¤ ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD hh24:mi:ss'
¤
¤ Is this the problem with the OLEDB driver? Or...
¤

Which OLEDB provider are you using? Oracle's or Microsoft's?


Paul
~~~~
Microsoft MVP (Visual Basic)
 
S

Sunil Menon

I am using the OLEDB provider of Oracle. This is my connection string
Connection string: Provider=OraOLEDB.Oracle;User
ID=AUTHMAN;PLSQLRSet=1; Data Source=MANESDB;

The oracle client version is 8.1.6...

Thanks & regards
Sunil
 
P

Paul Clement

¤ I am using the OLEDB provider of Oracle. This is my connection string
¤ Connection string: Provider=OraOLEDB.Oracle;User
¤ ID=AUTHMAN;PLSQLRSet=1; Data Source=MANESDB;
¤
¤ The oracle client version is 8.1.6...

It's really difficult to tell why this might be happening. The "Object reference not set" error
would seem to indicate that there is a problem with your Command object. Can you post the code where
the query in question is being executed?


Paul
~~~~
Microsoft MVP (Visual Basic)
 

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