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.
[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
);
| Exception type | Condition |
|---|---|
| ArgumentException | |
| InvalidOperationException | InvalidOperationException is
thrown under following conditions:
|
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.