View previous topic :: View next topic |
Author |
Message |
tykim
Joined: 21 Nov 2012 Posts: 2
|
Posted: Wed Nov 21, 2012 12:54 pm Post subject: RollbackTransaction throw exception |
|
|
Code: |
class A : VirtualRecord {...}
class A_RecordSet :VirtualRecordset {...}
string connectionString = "....";
VirtualConnection connection = new VirtualConnection(connectionString, ...);
A_RecordSet rs = new A_RecordSet(connection);
A a = rs[0]; //record is exist..
connection.BeginTransaction();
try
{
a.Edit();
a.Name = "test";
throw new Exception("on purpose....exception");
a.Update(false);
connection.CommitTransaction();
}
catch(Exception ex)
{
connection.RollbackTransaction();
}
|
I make excpetion on purpose...
connection.RollbackTransaction() throw exception....
COMException was unhandled.....
Stacktrace
at ADODB.RecordsetClass.Close()
at Infralution.VirtualData.VirtualConnection.ClearRecordsetCache()
at Infralution.VirtualData.VirtualConnection.RefreshRecordsets(Boolean notifyClients)
at Infralution.VirtualData.VirtualConnection.RollbackTransaction()
I don't know what's wrong...
Please help me...
[/code] |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Nov 21, 2012 10:38 pm Post subject: |
|
|
I' have tried replicating this issue using the Strongly Typed Recordset sample project - but haven't been able to. In the MainForm constructor I inserted the following:
Code: | OrderRecordset orderRS = new OrderRecordset(connection);
_dataGrid.DataSource = orderRS;
connection.BeginTransaction();
Order order = orderRS[0] as Order;
try
{
order.Edit();
order.CustomerID = "ALFKI";
throw new Exception("on purpose....exception");
}
catch (Exception e)
{
order.CancelUpdate();
connection.RollbackTransaction();
} |
The only difference is that I have added a CancelUpdate - so you could try that. Without the CancelUpdate the rollback still succeeds however I do then get an exception when the application exits as it tries to cleanup the open recordset.
What database are you using?
If you can replicate your problem in a self contained project that you can email a zipped copy of to support@infralution.com that will help a lot in tracking down the issue. _________________ Infralution Support |
|
Back to top |
|
|
MikeR
Joined: 25 Jun 2016 Posts: 29
|
Posted: Mon Jan 15, 2018 8:58 pm Post subject: |
|
|
Just saw this while looking through the forums.
I'm using PostgreSQL 9.6.
I find that if I begin a transaction, and have not completed ANY commits, then a rollback command will throw an exception.
I consider that bogus, I think that a rollback should just return normally if there's nothing to rollback.
So you're going to have to track what occurs within your transaction to prevent this from occurring. _________________ Thanks,
-- Mike R. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Jan 15, 2018 11:17 pm Post subject: |
|
|
I suspect that the exception you are seeing is from the underlying ADODB library (not from VDO) - so there probably is not much we can do about that. If you can post the details of the exception and the stack trace then we can confirm that. _________________ Infralution Support |
|
Back to top |
|
|
MikeR
Joined: 25 Jun 2016 Posts: 29
|
Posted: Mon Jan 15, 2018 11:26 pm Post subject: |
|
|
Sorry, has nothing to do with Infralution products, it's all PG driver at fault. Not your problem, just trying to help out a mate. _________________ Thanks,
-- Mike R. |
|
Back to top |
|
|
|