CommandType Property

MySQL Connector.Net

Collapse image Expand Image Copy image CopyHover image
Gets or sets a value indicating how the CommandText property is to be interpreted.

Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll) Version: 6.8.4.0

Syntax

C#
public override CommandType CommandType { get; set; }
Visual Basic
Public Overrides Property CommandType As CommandType
	Get
	Set
Visual C++
public:
virtual property CommandType CommandType {
	CommandType get () override;
	void set (CommandType value) override;
}

Field Value

One of the CommandType values. The default is Text.

Implements

IDbCommand..::..CommandType

Remarks

When you set the CommandType property to StoredProcedure, you should set the CommandText property to the name of the stored procedure. The command executes this stored procedure when you call one of the Execute methods.

Examples

The following example creates a MySqlCommand and sets some of its properties.
Visual Basic Copy imageCopy
Public Sub CreateMySqlCommand()
Dim myCommand As New MySqlCommand()
myCommand.CommandType = CommandType.Text
End Sub
C# Copy imageCopy
public void CreateMySqlCommand()
{
MySqlCommand myCommand = new MySqlCommand();
myCommand.CommandType = CommandType.Text;
}

See Also