Home All Groups Group Topic Archive Search About

ado.net begin informix transaction

Author
10 Nov 2005 11:27 PM
kevinkliu
Hi,

Is there any one used the following way to open a INFORMIX transaction
in ADO.NET?

   OleDbConnection conn = new OleDbConnection(connString);
   OleDbCommand cmd = new OleDbCommand("Begin Work", conn);
   cmd.ExecuteNonQuery();
   //....Do the other works .....//
   cmd = new OleDbCommand("Commit Work", conn);

Or

  OleDbConnection conn = new OleDbConnection(connString);
  OleDbTransaction trans = conn.BeginTransaction();
  OleDbCommand cmd = new OleDbCommand("Update XXX", conn); //Please
notice that the transaction object is not passed in..
  cmd.ExecuteNonQuery();
  trans.Commit();

This is not followed the way how ADO.NET handles the transaction. But
it works. Does anyone know if the above code will have any problem?

Thanks.

AddThis Social Bookmark Button