[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

(Rory Plaire)

1/21/2003 10:31:00 PM

Hi all,

I've see others on different newsgroups (aspnet) with this issue.

The error:

Unhandled Exception: System.NullReferenceException: Object reference
not set to an instance of an object.
at System.Data.Common.Odbc32.SQLExecDirectW(IntPtr StatementHandle,
String StatementText, Int32 TextLength)
at Microsoft.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior
behavior, String method)
at Microsoft.Data.Odbc.OdbcCommand.ExecuteNonQuery()

Context:
Running OdbcCommand.ExecuteNonQuery() with a CommandText property set
to a bunch of INSERTs (100 of them). It works on the first batch of
100, but gives me this error on the second batch. Everything is
executed in the same manner by this routine:

public void ExecuteNoRecSQL(string SQL)
{
bool bCloseConn = false;

OdbcCommand oCmd = new OdbcCommand();
oCmd.CommandText = SQL;
if(m_oConn.State != ConnectionState.Open)
{
this.Open();
bCloseConn = true;
}
oCmd.Connection = m_oConn;
oCmd.ExecuteNonQuery();
if(bCloseConn == true)
{
m_oConn.Close();
}
}


Platform:
Informix 7.31 TD5

I've heard that OleDbCommand doesn't suffer from this problem, but I'd
like to get ODBC to work...

Can anyone confirm this?

Thanks!
-rory 8)