CommandType Property

MySQL Connector/Net

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

Syntax

C#
public override CommandType CommandType { get; set; }
Visual Basic (Declaration)
Public Overrides Property CommandType As CommandType
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.
CopyVB.NET
Public Sub CreateMySqlCommand()
Dim myCommand As New MySqlCommand()
myCommand.CommandType = CommandType.Text
End Sub
CopyC#
public void CreateMySqlCommand()
{
MySqlCommand myCommand = new MySqlCommand();
myCommand.CommandType = CommandType.Text;
}

See Also