Commit;
Commit();
The Commit method saves all changes on the database server and finishes transaction.
When slice data is saved, which data source is a standard cube, the saving is executed within the external transaction.
Sub Main;
Var
MB: IMetabase;
DB: IDatabaseInstance;
Connect: ISecurityConnection;
Command: IDalCommand;
Tran: IConnectionTransaction;
Begin
MB := MetabaseClass.Active;
DB := MB.ItemById("BD").Open(Null) As IDatabaseInstance;
Connect := DB.Connection;
Command := Connect.CreateCommand("Insert Into Table_1 values ('A',1)");
Tran := Connect.StartTransaction(False);
Try
Command.Execute;
Tran.Commit;
Except
Tran.Rollback;
End Try;
Command.Close;
End Sub Main;
After executing the example connection to the DB server, on which the BD repository database is set, is performed. SQL query that inserts a new record in a table with the Table_1 physical name is created and executed for this connection. If there is any unsaved data, it is saved on the server.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Db;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
DB: IDatabaseInstance;
Connect: ISecurityConnection;
Command: IDalCommand;
Tran: IConnectionTransaction;
Begin
MB := Params.Metabase;
DB := MB.ItemById["BD"].Open(Null) As IDatabaseInstance;
Connect := DB.Connection;
Command := Connect.CreateCommand("Insert Into Table_1 values ('A',1)");
Tran := Connect.StartTransaction(False);
Try
Command.Execute();
Tran.Commit();
Except
Tran.Rollback();
End Try;
Command.Close();
End Sub;
See also: