Skip to main content
Contributor
Sep 10, 2023 8:06 PM UTC
Solved

Database Transaction

In the application I'm building, I have a need to make several insert/update/deletes for different custom tables, but the database call for those changes should happen within a transaction. Are there any OneStream API functions that will include the ability to run the database call as a transaction? I could just use the .NET Framework approach (SqlCommand), but then I'm a bit off the track.

Cheers, Frank

FrankDKAnswer
Contributor
Sep 11, 2023 6:37 AM UTC

Answer to my own question is, that a Begin and Commit Transaction exists in the OneStream API, through the DbConnInfo class

 

 

 

'' The Brapi.Database.DbConnInfo have methods for begin, commit and rollback
Using dbCon as DbConnInfo = Brapi.Database.CreateDatabaseConnectionInfo(si)
  dbCon.BeginTrans()
  '' Do calls to db
  dbCon.CommitTrans()
End Using

 

 

 

1 reply

FrankDKAuthorAnswer
Contributor
Sep 11, 2023 6:37 AM UTC

Answer to my own question is, that a Begin and Commit Transaction exists in the OneStream API, through the DbConnInfo class

 

 

 

'' The Brapi.Database.DbConnInfo have methods for begin, commit and rollback
Using dbCon as DbConnInfo = Brapi.Database.CreateDatabaseConnectionInfo(si)
  dbCon.BeginTrans()
  '' Do calls to db
  dbCon.CommitTrans()
End Using