RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TAdoDbxParameter Class

Represents a parameter that is passed to or from a command.

Pascal
TAdoDbxParameter = class(DbParameter, ICloneable);
C++
class TAdoDbxParameter : public DbParameter, public ICloneable;

Borland.Data.AdoDbxClientProvider

If you are using parameterized SQL or stored procedures, you can pass parameters to them using the TAdoDbxParameter class. The Direction property determines whether a parameter is an input parameter, an output parameter, or a return value. You can create a new instance of a TAdoDbxParameter object using the simple constructor syntax. You can also specify a number of overloaded values in the constructor.  

The TAdoDbxParameter class is an implementation of the ADO.NET DbParameter class. 

To pass runtime parameters for a parameterized SQL statement or stored procedure, use the TAdoDbxParameterCollection class. An empty TAdoDbxParameterCollection is returned by the TAdoDbxCommand.Parameters property. After successfully preparing the command, parameters are added to the TAdoDbxParameterCollection by calling the Add method and passing the parameter information such as name, datatype, precision, scale, size, and so on. You can use one of the overloaded Add methods or you can set individual TAdoDbxParameter properties such as Direction, Precision, Scale, DbType and Size.  

Parameter names must be unique, and the parameters must be added to the TAdoDbxParameterCollection in the same order in which parameter markers appear in the SQL. The Direction property, by default, is set to ParameterDirection.Input. In the case of stored procedures, it can be set to Output, InputOutput, or ReturnValue . If the inout parameter is expected to return more data than the input, you should specify the Precision as a size large enough to hold the output data.

Note: Not all databases support all the different parameter directions.
While specifying the parameter datatype, you can use either System.Type or the ADO.NET logical type and the subtype. You should set the Value property with the runtime value for all parameters before executing the command. After successful execution, output data is available in the Value property. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!