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. 如果名为的任何指定表包含任何特殊字符,则用户可能需要使用转义符语法或包含限定字符。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. 在调用执行方法之一时,将返回命名表的所有行和列。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 数据提供程序才支持 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.

适用于