Groups | Blog | Home
all groups > dotnet ado.net > september 2005 >

dotnet ado.net : Updating database rows usign OracleClient - .NET Framework 1.1


David Browne
9/30/2005 11:30:43 AM

[quoted text, click to view]

You are eating exceptions. Don't do that. It's a deeply wrong thing to do.

catch
{
myTrans.Rollback ();
return ReturnValue.DB_EXECUTENONQUERY;
}

Should be

catch
{
myTrans.Rollback ();
throw;
}

David

JAW
9/30/2005 4:19:04 PM
I have the following code......

private ReturnValue ProcessNonQuery (string sql)
{
ReturnValue status = ReturnValue.SUCCESS;

OracleTransaction myTrans = con.BeginTransaction ();

OracleCommand myUpdate = new OracleCommand(sql, con, myTrans);
myUpdate.CommandType = CommandType.Text;

try
{
int numRows = 0;
numRows = myUpdate.ExecuteNonQuery ();
}

catch
{
myTrans.Rollback ();
return ReturnValue.DB_EXECUTENONQUERY;
}

myTrans.Commit();

return status;
}


The connection is already made and the connection object (con) is valid. When I ussue a simple update statement the db
row is nerver updated. If I take this same statement (sql) and paste it into SQL worksheet using the same
username/password and run it, it works just fine. I have a simple connection statement of :

User ID = <user>; Password = <pwd>;Data Source = <dsn>.

The database server is Oracel 9i (9.2.x) and I have the appropiate 9i client on my development workstation.


Any ideas as to why the update is not occuring ?

Thanks !
David Browne
10/1/2005 4:59:04 PM

[quoted text, click to view]

If the update is not occuring then you should get an exception. Either that
or your update statement matches no rows.

David

JAW
10/1/2005 6:54:02 PM
David;

Thanks for the pointer, but I do not believe it solves my origianl issue. Any suggestions as to the solving of the
original issue ?

[quoted text, click to view]
JAW
10/2/2005 11:08:57 AM
Thaks for your time David.

J

[quoted text, click to view]
AddThis Social Bookmark Button