RAD Studio
ContentsIndex
PreviousUpNext
Supplying Parameters at Design Time

At design time, you can specify parameter values using the parameter collection editor. To display the parameter collection editor, click on the ellipsis button for the Params or Parameters property in the Object Inspector. If the SQL statement does not contain any parameters, no objects are listed in the collection editor.

Note: The parameter collection editor is the same collection editor that appears for other collection properties. Because the editor is shared with other properties, its right-click context menu contains the Add and Delete commands. However, they are never enabled for query parameters. The only way to add or delete parameters is in the SQL statement itself.
For each parameter, select it in the parameter collection editor. Then use the Object Inspector to modify its properties. 

When using the Params property (TParam objects), you will want to inspect or modify the following, 

The DataType property lists the data type for the parameter's value. For some datasets, this value may be correctly initialized. If the dataset did not deduce the type, DataType is ftUnknown, and you must change it to indicate the type of the parameter value. 

The DataType property lists the logical data type for the parameter. In general, these data types conform to server data types. For specific logical type-to-server data type mappings, see the documentation for the data access mechanism (BDE, dbExpress, InterBase). 

The ParamType property lists the type of the selected parameter. For queries, this is always ptInput, because queries can only contain input parameters. If the value of ParamType is ptUnknown, change it to ptInput

The Value property specifies a value for the selected parameter. You can leave Value blank if your application supplies parameter values at runtime. 

When using the Parameters property (TParameter objects), you will want to inspect or modify the following: 

The DataType property lists the data type for the parameter's value. For some data types, you must provide additional information:

  • The NumericScale property indicates the number of decimal places for numeric parameters.
  • The Precision property indicates the total number of digits for numeric parameters.
  • The Size property indicates the number of characters in string parameters.
The Direction property lists the type of the selected parameter. For queries, this is always pdInput, because queries can only contain input parameters. 

The Attributes property controls the type of values the parameter will accept. Attributes may be set to a combination of psSigned, psNullable, and psLong

The Value property specifies a value for the selected parameter. You can leave Value blank if your application supplies parameter values at runtime.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!