OdbcCommandBuilder.DeriveParameters(OdbcCommand) 方法

定义

从指定的 OdbcCommand 存储过程检索参数信息,并填充 Parameters 指定 OdbcCommand 对象的集合。

public:
 static void DeriveParameters(System::Data::Odbc::OdbcCommand ^ command);
public static void DeriveParameters(System.Data.Odbc.OdbcCommand command);
static member DeriveParameters : System.Data.Odbc.OdbcCommand -> unit
Public Shared Sub DeriveParameters (command As OdbcCommand)

参数

command
OdbcCommand

OdbcCommand引用要从中派生参数信息的存储过程。 派生参数将添加到 Parameters 集合中 OdbcCommand

例外

基础 ODBC 驱动程序不支持返回存储过程参数信息,或者命令文本不是有效的存储过程名称,或者 CommandType 指定的不是 CommandType.StoredProcedure

注解

DeriveParameters 覆盖任何现有参数信息 OdbcCommand

DeriveParameters 需要对数据源进行额外调用才能获取信息。 如果事先知道参数信息,则通过显式设置信息来填充参数集合的效率更高。

只能与存储过程一起使用 DeriveParameters 。 不能使用 DeriveParameters 使用任意 Transact-SQL 语句(如参数化 SELECT 语句)填充 OdbcParameterCollection

适用于

另请参阅