Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

RollbackTransaction throw exception

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Data Objects Support
View previous topic :: View next topic  
Author Message
tykim



Joined: 21 Nov 2012
Posts: 2

PostPosted: Wed Nov 21, 2012 12:54 pm    Post subject: RollbackTransaction throw exception Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 4972

PostPosted: Wed Nov 21, 2012 10:38 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
MikeR



Joined: 25 Jun 2016
Posts: 28

PostPosted: Mon Jan 15, 2018 8:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 4972

PostPosted: Mon Jan 15, 2018 11:17 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
MikeR



Joined: 25 Jun 2016
Posts: 28

PostPosted: Mon Jan 15, 2018 11:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Data Objects Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group