Export (0) Print
Expand All

SqlCommandBuilder.DeriveParameters Method

Retrieves parameter information from the stored procedure specified in the SqlCommand and populates the Parameters collection of the specified SqlCommand object.

Namespace: System.Data.SqlClient
Assembly: System.Data (in system.data.dll)

public static void DeriveParameters (
	SqlCommand command
)
public static void DeriveParameters (
	SqlCommand command
)
public static function DeriveParameters (
	command : SqlCommand
)
Not applicable.

Parameters

command

The SqlCommand referencing the stored procedure from which the parameter information is to be derived. The derived parameters are added to the Parameters collection of the SqlCommand.

Exception typeCondition

InvalidOperationException

The command text is not a valid stored procedure name.

DeriveParameters overwrites any existing parameter information for the SqlDbCommand.

DeriveParameters requires an additional call to the database 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.

You can only use DeriveParameters with stored procedures. You cannot use DeriveParameters with extended stored procedures. You cannot use DeriveParameters to populate the SqlParameterCollection with arbitrary Transact-SQL statements, such as a parameterized SELECT statement.

For more information, see Using Stored Procedures with a Command.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft