DbDataSource.CreateCommand(String) 方法

定義

回傳 DbCommand 已準備好執行的 DbDataSource

public System.Data.Common.DbCommand CreateCommand(string? commandText = default);
member this.CreateCommand : string -> System.Data.Common.DbCommand
Public Function CreateCommand (Optional commandText As String = Nothing) As DbCommand

參數

commandText
String

這個方法回傳的初始化 DbCommand 文字指令。

傳回

DbCommand A 已準備好對 執行。DbDataSource

備註

此方法回傳的指令已設定為對其來源 DbDataSource執行; Connection 無需設定,設定後會拋出例外。

由於這些指令沒有明確管理的連線,無法將它們用於交易,且嘗試設定 Transaction 會拋出例外。 要使用交易,先從那裡取得連線 OpenConnection 並建立指令。

適用於