DB2CommandBuilder.DeriveParameters Method
Retrieves parameter information from a stored procedure, or a command text specified in the DB2Command and populates the Parameters collection of the specified DB2Command object.
- Namespace:
IBM.Data.DB2- Assembly:
IBM.Data.DB2(inIBM.Data.DB2.dll)
Syntax
[Visual Basic]
Public Shared Sub DeriveParameters( _
ByVal command As DB2Command
_
)
[C#]
public static void DeriveParameters(
DB2Command
command
);
[C++]
public: static void DeriveParameters(
DB2Command
* command
);
[JScript]
public static function DeriveParameters(
command : DB2Command
);
Parameters
- command
- The DB2®Command referencing a stored procedure, or a command text from which the parameter information is to be derived. The derived parameters are added to the DB2Command.Parameters collection of the DB2Command.
Exceptions
| Exception type | Condition |
|---|---|
| ArgumentException | |
| InvalidOperationException | InvalidOperationException is
thrown under following conditions:
|
Remarks
DeriveParameters overwrites any existing parameter information for the DB2Command.
You can use DeriveParameters when CommandType is set to CommandType.StoredProcedure, or CommandType.Text. If CommandType.StoredProcedure is specified, CommandText must contain a valid stored procedure name. If CommandType.Text is specified, CommandText must contain a SQL statement, or a stored procedure call statement with valid parameters.
Using DeriveParameters on an overloaded stored procedure is not recommended, because all parameters for all qualifying procedures are returned.
By default, DeriveParameters adds the ReturnValue parameter to the Parameters collection of the DB2Command.
DeriveParameters requires an extra call to the data server to obtain the information. If the parameter information is known in advance, it is more efficient to populate the parameters collection by setting the information explicitly.