params
Topic group Related topics Example
Parameters for an SQL statement or stored procedure call.
Property of
Query, StoredProc
Description
The params property contains an associative array that contains parameter names and values, if any, for an SQL statement in a Query object or a stored procedure call in a StoredProc object.
For a Query object, assigning an SQL statement with parameters to the sql property automatically creates the corresponding elements in the params array. Parameters are indicated by colons. The values you want to substitute are then assigned to the array elements in one of two ways:
Manually, before the query is activated or requeried with requery( ).
By assigning a masterSource to the query, in which case parameters are substituted with the matching fields from the fields array of the masterSource’s rowset. Parameters are matched to fields by name.
For a StoredProc object, the Borland Database Engine will try to get the names and types of any parameters needed by a stored procedure, once the procedure name is assigned to the procedureName property. This works to varying degrees for most SQL servers. If it succeeds, the params array is filled automatically with the corresponding Parameter objects. You must then assign the values you want to substitute to the value property of those objects.
For SQL servers that do not return the necessary stored procedure information, include the parameters, preceded with colons, in parentheses after the procedure name. The corresponding Parameter objects in the params array will be created for you; then you must assign the necessary type and value information.