[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'DB' (#fcl)

# TDataSet.BeforePost

Event called before changes are posted to the underlying database

## Declaration

Source position: db.pas line 1754

`public property TDataSet.BeforePost : TDataSetNotifyEvent read FBeforePost write FBeforePost;`

## Description

BeforePost is triggered at the start of the TDataset.Post method, when the dataset is still in one of the edit states (dsEdit,dsInsert). If the dataset was not in an edit state when Post is called, the BeforePost event is not triggered. This event can be used to supply values for required fields that have no value yet (the Post operation performs the check on required fields only after this event), or it can be used to abort the post operation: if an exception is raised during the BeforePost operation, the posting operation is cancelled, and the dataset remains in the editing state it was in before the post operation.

## See also

TDataset.post |  | Post pending edits to the database.
TDataset.AfterPost |  | Event called after changes have been posted to the underlying database
TDataset.State |  | Current operational state of the dataset