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.)

注解

当属性设置为StoredProcedure时, IDbCommand.CommandText应将属性设置为要访问的存储过程的名称。 IDbCommand.CommandTypeWhen 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.

当属性设置为TableDirect时, IDbCommand.CommandText应将属性设置为要访问的表的名称。 IDbCommand.CommandTypeWhen 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.

备注

TableDirect仅 OLE DB 的 .NET Framework 数据提供程序支持。TableDirect 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.

适用于