M
Mark Vuksani
Hi,
I have a trigger like this (simplified to illustrate the problem):
--------
CREATE TRIGGER Test ON [dbo].[TestTable]
FOR INSERT, UPDATE, DELETE
AS
RAISERROR( 'test trigger error !', 16, 1)
---------
And a C# code portion: (new record inserted in dsFormTest.TestTable)
---------
OdbcTransaction odbcTrans = null;
try {
if ( odbcConn.State != ConnectionState.Open ) odbcConn.Open();
odbcTrans = odbcConn.BeginTransaction();
odaTest.InsertCommand.Transaction = odbcTrans;
odaTest.Update( dsFormTest.TestTable );
odbcTrans.Commit();
}
catch( Exception xc ) {
if ( odbcTrans != null ) odbcTrans.Rollback();
MessageBox.Show( xc.ToString() );
}
odbcConn.Close();
----------
BUT, instead of rolling back transaction, the odbcTrans.Rollback() throws
new exception with message:
System.InvalidOperationException: RollbackTransaction requires an open and
available Connection. The connection's current state is Open, Fetching.
any clues why?
I have a trigger like this (simplified to illustrate the problem):
--------
CREATE TRIGGER Test ON [dbo].[TestTable]
FOR INSERT, UPDATE, DELETE
AS
RAISERROR( 'test trigger error !', 16, 1)
---------
And a C# code portion: (new record inserted in dsFormTest.TestTable)
---------
OdbcTransaction odbcTrans = null;
try {
if ( odbcConn.State != ConnectionState.Open ) odbcConn.Open();
odbcTrans = odbcConn.BeginTransaction();
odaTest.InsertCommand.Transaction = odbcTrans;
odaTest.Update( dsFormTest.TestTable );
odbcTrans.Commit();
}
catch( Exception xc ) {
if ( odbcTrans != null ) odbcTrans.Rollback();
MessageBox.Show( xc.ToString() );
}
odbcConn.Close();
----------
BUT, instead of rolling back transaction, the odbcTrans.Rollback() throws
new exception with message:
System.InvalidOperationException: RollbackTransaction requires an open and
available Connection. The connection's current state is Open, Fetching.
any clues why?