Hello,
I have tried to roll back external transaction and also tried to abort OracleBulkCopy() but it still inserted all rows. Anyone knows how to do this?
Case 1: Didn't work. All row inserted anyway.
OracleConnection connection = new OracleConnection(ConnectionString);
connection.Open();
OracleTransaction trans = connection.BeginTransaction();
OracleBulkCopy bulkCopy = new OracleBulkCoopy(connection,OracleBulkCopyOptions.Default);
bulkCopy.DestinationTableName = "SomeTable";
bulkCopy.WriteToServer(SomeDataTable);
trans.Rollback();
Case 2: Use OracleRowsCopiedEventHandler
delegate and in this callback set Oracle.RowsCopiedEventsArgs.Abort
to true
and then rollback on the transaction in catch block. Didn't work either. It seems that whatever insertion before the Abort call is already in the database. OracleBulkCopy()
is inferior to SqlBulkCopy()
the way I see it.
Thanks. Hoang