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

# TDataSource.Edit

Put the dataset in edit mode, if needed

## Declaration

Source position: db.pas line 1771

`public procedure TDataSource.Edit;`

## Description

Edit will check AutoEdit: if it is True, then it puts the Dataset it is connected to in edit mode, if it was in browse mode. If AutoEdit is False, then nothing happens. Application or component code that deals with GUI development should always attempt to set a dataset in edit mode through this method instead of calling TDataset.Edit directly.

## Errors

An EDatabaseError exception can occur if the dataset is read-only or fails to set itself in edit mode. (e.g. unidirectional datasets).

## See also

TDatasource.AutoEdit |  | Should the dataset be put in edit mode automatically
TDataset.Edit |  | Set the dataset in editing mode.
TDataset.State |  | Current operational state of the dataset

The latest version of this document can be found at lazarus-ccr.sourceforge.net .