How to use the CommandText property
In this snippet:
- How to use the CommandText property
- How to set the CommandTimeout property
- How to set the CommandType property
VB.Net
Public Sub
CreateCommand()
Dim command As New SqlCommand()
command.CommandText = "SELECT * FROM MyTable ORDER BY ID"
command.CommandTimeout = 15
command.CommandType = CommandType.Text
End Sub
C#
public void
CreateCommand()
{
SqlCommand command = new SqlCommand();
command.CommandText = "SELECT * FROM MyTable ORDER BY ID";
command.CommandTimeout = 15;
command.CommandType = CommandType.Text;
}