N
Niraj
Hi;
I am trying to use nested transaction but getting
exception
System.InvalidOperationException: OleDbConnection does not
support parallel transactions.
Please help
Thanks
Here is my code...
OleDbConnection conn =
GetConnection();
if( conn.State ==
ConnectionState.Closed )
conn.Open();
OleDbTransaction T1 =
conn.BeginTransaction();
string sqlStr = "INSERT INTO
XFER_REC( XFERLST_NAME, XFERLST_DESCRIPTION, STYLE,
SOURCE )"
+ " VALUES ( 'Test', 'test', 1, 3 )";
OleDbCommand cmd = new OleDbCommand
( sqlStr, conn, T1 );
cmd.CommandType = CommandType.Text;
try
{
cmd.ExecuteNonQuery();
//Let's try to add record
inside child table...
if(conn.State ==
ConnectionState.Closed )
conn.Open();
OleDbTransaction T2 =
conn.BeginTransaction();
sqlStr = "INSERT INTO
XFER_DO_MEASURES(XR_XFER_ID, XDM_ID, DO_MEASURE )"
+ " VALUES ( 71, 25, 111 )";
cmd = new OleDbCommand(
sqlStr, conn, T2 );
cmd.CommandType =
CommandType.Text;
cmd.ExecuteNonQuery();
T2.Commit();
T1.Commit();
}
catch( Exception e )
{
T1.Rollback();
System.Diagnostics.Trace.Write( e.ToString() );
}
I am trying to use nested transaction but getting
exception
System.InvalidOperationException: OleDbConnection does not
support parallel transactions.
Please help
Thanks
Here is my code...
OleDbConnection conn =
GetConnection();
if( conn.State ==
ConnectionState.Closed )
conn.Open();
OleDbTransaction T1 =
conn.BeginTransaction();
string sqlStr = "INSERT INTO
XFER_REC( XFERLST_NAME, XFERLST_DESCRIPTION, STYLE,
SOURCE )"
+ " VALUES ( 'Test', 'test', 1, 3 )";
OleDbCommand cmd = new OleDbCommand
( sqlStr, conn, T1 );
cmd.CommandType = CommandType.Text;
try
{
cmd.ExecuteNonQuery();
//Let's try to add record
inside child table...
if(conn.State ==
ConnectionState.Closed )
conn.Open();
OleDbTransaction T2 =
conn.BeginTransaction();
sqlStr = "INSERT INTO
XFER_DO_MEASURES(XR_XFER_ID, XDM_ID, DO_MEASURE )"
+ " VALUES ( 71, 25, 111 )";
cmd = new OleDbCommand(
sqlStr, conn, T2 );
cmd.CommandType =
CommandType.Text;
cmd.ExecuteNonQuery();
T2.Commit();
T1.Commit();
}
catch( Exception e )
{
T1.Rollback();
System.Diagnostics.Trace.Write( e.ToString() );
}