Home All Groups Group Topic Archive Search About
Author
9 Feb 2006 12:34 AM
tim.romanowski
Hello,

I am having a wierd problem.  I am using an OleDBCommand to insert a
new row into a table on an Oracle 10g database.

My Code looks like this

bool result = ( command.ExecuteNonQuery( statement ) > 0 );

last night the Oracle Database was hung due to some issues with the
file sizes or something
I am not sure .

The problem is, is that all of the inserts in my code passed, meaning
that result was true,
and no exceptions where thrown.

is there a way to get a return / error code from the ExecuteNonQuery()?


All I have read says that the return is the number of rows affected.
if this returns 1 but Oracle did not actually insert the row, the only
way for me to tell is to select back out the row to make sure it is
there.  I kinda do not want to do that.

Any help would be appreciated

thank you in advance

Tim

Author
9 Feb 2006 2:30 AM
Val Mazur (MVP)
Hi Tim,

In a case of error, ExecuteNonQuery suppose to throw an exception. You do
not need to check for error. If you are sure that ExecuteNonQuery returns 1
and database is not updated, then it looks like a bug in a provider or
something is wrong on a database side. Another potential issue is the if
inserts were done inside of the transaction, then ExecuteNonQuery returned 1
for each insert, but transaction was automatically rolled back after server
crashed. In this case you will not see any updates in a database

--
Val Mazur
Microsoft MVP
http://xport.mvps.org


<tim.romanow***@gmail.com> wrote in message
Show quote
news:1139445276.932771.284890@g44g2000cwa.googlegroups.com...
> Hello,
>
> I am having a wierd problem.  I am using an OleDBCommand to insert a
> new row into a table on an Oracle 10g database.
>
> My Code looks like this
>
> bool result = ( command.ExecuteNonQuery( statement ) > 0 );
>
> last night the Oracle Database was hung due to some issues with the
> file sizes or something
> I am not sure .
>
> The problem is, is that all of the inserts in my code passed, meaning
> that result was true,
> and no exceptions where thrown.
>
> is there a way to get a return / error code from the ExecuteNonQuery()?
>
>
> All I have read says that the return is the number of rows affected.
> if this returns 1 but Oracle did not actually insert the row, the only
> way for me to tell is to select back out the row to make sure it is
> there.  I kinda do not want to do that.
>
> Any help would be appreciated
>
> thank you in advance
>
> Tim
>

AddThis Social Bookmark Button