Show: Delphi C++
Display Preferences

Data.Win.ADODB.TADOQuery.SQL

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property SQL: TStrings read GetSQL write SetSQL;

C++

__property System::Classes::TStrings* SQL = {read=GetSQL, write=SetSQL};

Properties

Type Visibility Source Unit Parent
property published
Data.Win.ADODB.pas
Data.Win.ADODB.hpp
Data.Win.ADODB TADOQuery

Description

Contains the text of the SQL statement to execute for the ADO query.

Use SQL to provide the SQL statement that an ADO query component executes when its ExecSQL or Open method is called.

The SQL statement provided to the SQL property may contain replaceable parameters, following standard ADO syntax conventions. Parameters are created and stored in the Parameters property.

At design time, edit the SQL statement using the String List editor invoked by clicking the ellipsis button of the property in the Object Inspector. At run time, use properties and methods of string list objects to clear the current contents, add new contents, or to modify existing contents.

with ADOQuery1 do begin
with SQL do begin
Clear;
Add('SELECT EmpNo, LastName, FirstName, HireDate');
Add('FROM Employee');
end;
Open;
end;
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("SELECT EmpNo, LastName, FirstName, HireDate");
ADOQuery1->SQL->Add("FROM Employee");
ADOQuery1->Open();
Note: The library does not evaluate the SQL sent to the database via a TADOQuery component. The SQL used must be valid for the particular database type accessed via ADO. Any error messages passed back to the application will have originated at the ADO or database level, and so will have error codes and messages specific to those systems.

See Also

Code Examples


Personal tools
In Other Languages
Previous Versions
Assistance