SqlCommandBuilder.DeriveParameters(SqlCommand) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從指定於 的 SqlCommand 儲存程序中取得參數資訊,並填充 Parameters 指定 SqlCommand 物件的集合。
public:
static void DeriveParameters(System::Data::SqlClient::SqlCommand ^ command);
public static void DeriveParameters(System.Data.SqlClient.SqlCommand command);
static member DeriveParameters : System.Data.SqlClient.SqlCommand -> unit
Public Shared Sub DeriveParameters (command As SqlCommand)
參數
- command
- SqlCommand
參考 SqlCommand 參數資訊所依據的儲存程序。 導出參數會加入 Parameters 的集合 SqlCommand中。
例外狀況
指令文本並非有效的儲存程序名稱。
備註
DeriveParameters覆蓋任何現有的參數資訊。SqlDbCommand
DeriveParameters 需要額外呼叫資料庫以取得資訊。 若參數資訊事先已知,則透過明確設定資訊來填充參數集合會更有效率。
你只能用 DeriveParameters 儲存程序。 你無法搭配擴充儲存程序使用 DeriveParameters 。 你不能用 DeriveParameters 來填充 SqlParameterCollection 中任意的 Transact-SQL 陳述句,例如參數化的 SELECT 陳述句。
欲了解更多資訊,請參閱 「參數與參數資料型態的配置」。