CommandType Enum

Definition

Specifies how a command string is interpreted.

public enum CommandType
Inheritance
CommandType

Fields

Name Value Description
Text 1

An SQL text command. (Default.)

StoredProcedure 4

The name of a stored procedure.

TableDirect 512

The name of a table.

Remarks

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

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. When the CommandText property names multiple tables, a join of the specified tables is returned.

Note

TableDirect is only supported by the .NET Framework Data Provider for OLE DB. Multiple table access is not supported when IDbCommand.CommandType is set to TableDirect.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0