Data.SqlExpr.TSQLQuery.Params

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Params: TParams read FParams write SetParameters;

C++

__property Params;

Properties

Type Visibility Source Unit Parent
property published
Data.SqlExpr.pas
Data.SqlExpr.hpp
Data.SqlExpr TSQLQuery

Description

Represents the parameters for a query or stored procedure.

Data.SqlExpr.TSQLQuery.Params inherits from Data.SqlExpr.TCustomSQLDataSet.Params. All content below this line refers to Data.SqlExpr.TCustomSQLDataSet.Params.

Represents the parameters for a query or stored procedure.

Params is a collection of TParam objects that represent the parameters of a query or stored procedure specified by the SQL dataset. When you specify a query by setting the CommandText property (or the SQL property in TSQLQuery), the SQL dataset automatically parse the query and fills Params with a TParam object for every parameter in the query. Similarly, when you specify a stored procedure by setting the CommandText property (or the StoredProcName property in TSQLStoredProc), the SQL dataset automatically asks the server for a list of stored procedure parameters and fills Params with a TParam object for every parameter of the stored procedure.

At design-time, use the Params property editor to access the individual TParam objects. For queries, use this property editor to check the DataType property of each parameter and to assign values to the parameters. For stored procedures, you may need to do more, changing the type or number of parameters if the server does not supply complete information about stored procedure parameters.

You can also use Params to assign parameter properties in code at runtime.

Note: If you do not assign values to input parameters before opening the dataset, it fetches values from the dataset identified by the DataSource property. However, this only works if the individual TParam objects have the same names as fields in the master dataset.

See Also