EPUB | CHM | PDF

TPSQLDatabase.Methods.SelectStringXXX

Top Previous Next

Since v2.5.2

Executes SQL Query and return result into TStrings object passed as parameter.

Syntax:

procedure SelectStrings(aSQL: string; aList: TStrings; aFieldName: string); overload;
procedure SelectStrings(aSQL: string; aList: TStrings; aFieldNumber: integer = 0); overload;

Description:

Use these methods to execute an SQL statement against the database without the overhead of using a TPSQLQuery object. It returns result set as a values of field specified by number (aFieldNumber parameter) or by name (aFieldName parameter). If aFieldNumber parameter is omitted, the function returns the values of the first field.

Parameters:

aSQL

A String value containing the statement to be executed.

aList

Object of TStrings class or it's descendant.

aFieldNumber

Field number to return its value by method. Fields are numbered from zero. If this parameter is omitted it is assumed to be 0. This means that first field's value will be returned.

aFieldName

Field name to return its value by method.

Example:

This example will populate Memo1 with rows names of 'test' table:

PSQLDatabase1.SelectStrings('SELECT attname FROM pg_attribute WHERE attrelid = ''test''::regclass', Memo1.Lines);

See also: Execute() method