Forum Discussion

FrankDK's avatar
FrankDK
Contributor
2 years ago

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

  • 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

     

     

     

  • 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