AnyDAC
ContentsIndexHome
PreviousUpNext
TADTable.Open Method

Executes the specified SQL statement and opens dataset.

Group
Links
Parameters 
Description 
ASQL 
A SQL command to execute. 

Call Open to execute the SQL statement specified in ASQL or is currently assigned to the internal command object, if ASQL is empty. 

The method closes the dataset if it was active, then assigns ASQL to the command text, and sets the Active property to True. When Active is true, the dataset is populated with data from a database. 

When an application needs to execute the same SQL command many times, then an application may ordinarily set SQL property, call Prepare before calling Open for the first time, then use any Open version without specifying ASQL. 

Use ResourceOptions.CmdExecMode to control asynchronous execution mode. And ResourceOptions.CmdExecTimeout to set maximum command execution time. After that time command execution will be canceled and exception raised. 

To cancel command execution use TADAdaptedDataSet.AbortJob

If DBMS returns error, then AnyDAC raises an exception. It may be analyzed in OnError event.

procedure Open(const ATableName: String); overload;
ADQuery1.Open('select * from customers');
What do you think about this topic? Send feedback!