Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
163
Добавлен:
11.05.2015
Размер:
4.73 Mб
Скачать

SQL Params AsBoolean property

Declaration

property AsBoolean: boolean;

Description

The AsBoolean property can be used to read and write to the Value property using native Delphi boolean values instead of the string values normally required by Value.

Example

This example uses the AsBoolean property to pass in a native Delphi boolean value as the first parameter value to the Stored Procedure the Report is based on:

Crpe1.ReportName := 'C:\Company.rpt';

Crpe1.SQL.Params.Retrieve;

Crpe1.SQL.Params[0].AsBoolean := True;

Crpe1.Execute;

SQL Params AsDate property

Declaration

property AsDate: TDateTime;

Description

The AsDate property can be used to read and write to the Value property using native Delphi DateTime values instead of the string values normally required by Value.

When reading this property, only the Date part of the Value string will be included in the result returned.

When writing this property, only the Date part of the TDateTime passed to it will be formatted in the Value string.

NOTE: Most Stored Procedure Parameters that involve dates are read by the Print Engine as a formatted date/ time string: '1999-01-01 00:00:00.000'. When sending the Param values back to the Engine, if the time part is not included, even though it may not be used by the Stored Procedure, an error will result. When in doubt, inspect the format of the Value property after calling the Retrieve method, and the expected format will be displayed. If it includes the time, use the AsDateTime property instead of AsDate.

VCL Reference

634

Example

This example uses the AsDate property to pass in a native Delphi datetime value as the first parameter value to the Stored Procedure the Report is based on:

Crpe1.ReportName := 'C:\Company.rpt';

Crpe1.SQL.Params.Retrieve;

Crpe1.SQL.Params[0].AsDate := Now;

Crpe1.Execute;

SQL Params AsDateTime property

Declaration

property AsDateTime: TDateTime;

Description

The AsDateTime property can be used to read and write to the Value property using native Delphi datetime values instead of the string values normally required by Value.

When reading this property, both the Date and Time portions of the Value string will be included in the result returned.

When writing this property, both the Date and Time portions of the TDateTime passed in will be formatted in the Value string.

Example

This example uses the AsDateTime property to pass in a native Delphi datetime value as the first parameter value to the Stored Procedure the Report is based on:

Crpe1.ReportName := 'C:\Company.rpt';

Crpe1.SQL.Params.Retrieve;

Crpe1.SQL.Params[0].AsDateTime := Now;

Crpe1.Execute;

SQL Params AsFloat property

Declaration

property AsFloat: double;

VCL Reference

635

Description

The AsFloat property can be used to read and write to the Value property using native Delphi floating point values instead of the string values normally required by Value.

Example

This example uses the AsFloat property to pass in a native Delphi floating point value as the first parameter value to the Stored Procedure the Report is based on:

Crpe1.ReportName := 'C:\Company.rpt';

Crpe1.SQL.Params.Retrieve;

Crpe1.SQL.Params[0].AsFloat := 1.22;

Crpe1.Execute;

SQL Params AsInteger property

Declaration

property AsInteger: integer;

Description

The AsInteger property can be used to read and write to the Value property using native Delphi integer values instead of the string values normally required by Value.

Example

This example uses the AsInteger property to pass in a native Delphi integer value as the first parameter value to the Stored Procedure the Report is based on:

Crpe1.ReportName := 'C:\Company.rpt';

Crpe1.SQL.Params.Retrieve;

Crpe1.SQL.Params[0].AsInteger := 1;

Crpe1.Execute;

SQL Params Item property

Declaration

property Item[const nIndex: integer]: TCrpeStoredProcParams;

VCL Reference

636

Description

The Item property is a default array property. It is read-only, and only available at runtime. Its primary use is to provide an easy way to navigate through the various items stored in the Params object, allowing the object to be treated like an array.

Item is a default property, so it does not need to be specified when using the subscript: Params[2] is the same as Params.Item[2].

Item returns a reference to itself, so the Params properties can be used right after the subscript: Params[2].Value := '100';

Example

Since Item is a default array property, the following two blocks of code do the same thing:

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.SQL.Params.Retrieve;

{Set Params object to the 3rd parameter} Crpe1.SQL.Params.Item[2];

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.SQL.Params.Retrieve;

{Set Params object to the 3rd parameter} Crpe1.SQL.Params[2];

SQL Params ItemIndex property

Declaration

property ItemIndex: integer;

Description

ItemIndex is a Run-time only property which can be used to obtain the current Params item number, or set the Params object to another item.

Each object in the Crystal component that can contain more than one item uses an internal Index to maintain which item it is currently looking at, similar to the ItemIndex property of a ListBox. This Index is updated whenever the Item property is used (Params[2], for example), or whenever the key property (if applicable) is assigned a new lookup value (key properties are things like Formulas.Name, or SortFields.Number which serve as look-up properties).

The easiest way to read the current Index number is to use the ItemIndex property.

VCL Reference

637

Соседние файлы в папке crystal