1. Arcady Abramov
  2. SnapDevelop
  3. Sunday, 16 July 2023 09:29 AM UTC

Hello, Team

It is unclear to me how to use DataContext.Commit in SnapDevelop.

I had the following code in PB.

//*******************************************

ds1 = create datastore

ds1.setTransobject(sqlca)

ds1.retrieve()

/// some code

ds1.update()

commit;

//*********************************************

In c# it looks like this:

DataStore ds1 = new DataStore(DataContext ctx)

ds1.retrieve()

/// some code

ds1.update()

ctx.Commit()

 

In C# commit throws exception "transaction not started". What does it mean exactly?

Connection to the DB definitely exists, retrieves are passed normally and data is being retrieved from the DB.

Is there an actual problem? How to workaround it?

 

Thank you

Arcady

 

 

 

Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Monday, 17 July 2023 02:48 AM UTC
  2. SnapDevelop
  3. # 1

Hi Arcady,

I think you need to call context.BeginTransaction() first, refer to Working with Transactions in .NET DataStore (appeon.com)

Regards, Logan

Comment
  1. Arcady Abramov
  2. Monday, 17 July 2023 04:54 AM UTC
Thank you, Logan

This fixed the exception problem
  1. Helpful
  1. Francisco Martinez @Appeon
  2. Monday, 17 July 2023 14:42 PM UTC
Hi Arcady, it would be fantastic if you could mark Logan's answer as the solution to this post.



Regards - Francisco
  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.