---
url: >-
  /statelake/scripting-reference/classes/data-definition-class-tflodatasource/tflodatasource.starttransaction.md
---

# TFloDataSource.StartTransaction

This starts a new database transaction against the **Data Definition**.

Database transactions are handled automatically, so you do not normally need to use this function unless you want specific control over database transactions.

If you start a transaction you will also need to manage the Committing or Rollback of the transaction using **CommitTran** and **RollbackTran**.

**Declaration**: Function StartTransaction : boolean

This example also displays an error if the transaction has not started.

```pascal
procedure OnMapEvent(var Value:Variant);
begin
 //Check that the transaction has started
 if Not Source.StartTransaction then
    LogError('Unable to start new transaction');
end;
```

Please also refer to [TFloDataSource.CommitTran](/statelake/scripting-reference/classes/data-definition-class-tflodatasource/tflodatasource.committran) and [TFloDataSource.RollbackTran](/statelake/scripting-reference/classes/data-definition-class-tflodatasource/tflodatasource.rollbacktran).
