CommandType 列舉

定義

指定如何解譯命令字串。Specifies how a command string is interpreted.

public enum class CommandType
public enum CommandType
type CommandType = 
Public Enum CommandType
繼承
CommandType

欄位

StoredProcedure 4

預存程序的名稱。The name of a stored procedure.

TableDirect 512

資料表的名稱。The name of a table.

Text 1

SQL 文字命令An SQL text command. (預設值。)(Default.)

備註

IDbCommand.CommandType 屬性設定為 StoredProcedure時,IDbCommand.CommandText 屬性應設定為要存取之預存程式的名稱。When the IDbCommand.CommandType property is set to StoredProcedure, the IDbCommand.CommandText property should be set to the name of the stored procedure to be accessed. 如果任何名為的指定資料表包含任何特殊字元,則使用者可能必須使用 escape 字元語法或包含限定字元。The user may be required to use escape character syntax or include qualifying characters if any of the specified tables named contain any special characters. 當您呼叫命令物件的其中一個 Execute 方法時,將會傳回命名資料表或資料表的所有資料列和資料行。All rows and columns of the named table or tables will be returned when you call one of the Execute methods of a Command object.

IDbCommand.CommandType 屬性設定為 TableDirect時,IDbCommand.CommandText 屬性應設定為要存取之資料表的名稱。When the IDbCommand.CommandType property is set to TableDirect, the IDbCommand.CommandText property should be set to the name of the table to be accessed. 如果有任何具名資料表包含任何特殊字元,使用者可能需要使用逸出字元語法或包含限定字元。The user may be required to use escape character syntax or include qualifying characters if any of the tables named contain any special characters. 當您呼叫其中一個 Execute 方法時,將會傳回命名資料表的所有資料列和資料行。All rows and columns of the named table will be returned when you call one of the Execute methods.

若要存取多個資料表,請使用逗號分隔清單(不含空格或填補),其中包含要存取之資料表的名稱。In order to access multiple tables, use a comma delimited list, without spaces or padding, containing the names of the tables to access. CommandText 屬性命名多個資料表時,就會傳回指定之資料表的聯結。When the CommandText property names multiple tables, a join of the specified tables is returned.

注意

只有 OLE DB 的 .NET Framework Data Provider 支援 TableDirectTableDirect is only supported by the .NET Framework Data Provider for OLE DB. IDbCommand.CommandType 設定為 TableDirect時,不支援多個資料表存取。Multiple table access is not supported when IDbCommand.CommandType is set to TableDirect.

適用於