System.Data Namespace IDbCommand Class
Sets or retrieves the statement to execute at the data source.
Script |
IDbCommand.CommandText [ = strCommand ] |
strCommand |
The statement to execute. |
The property is read/write with no default value.
When the CommandType property is set to StoredProcedure, the CommandText property should be set to the name of the stored procedure. The command executes this stored procedure when you call one of the Execute methods.
The following example initializes an instance of the derived OleDbCommand class, and sets some of its properties.
void setOleDbCommand ( ) {
OleDbCommand myCmd = new OleDbCommand ( );
myCmd.CommandText = "SELECT * FROM Categories ORDER BY CategoryID";
myCmd.CommandTimeout = 15;
}
Public Sub setOleDbCommand ( )
Dim myCmd As New OleDbCommand ( )
myCmd.CommandText = "SELECT * FROM Categories ORDER BY CategoryID"
myCmd.CommandTimeout = 15
End Sub |
|
C# |
VB |
IDbCommand Members Connection CommandTimeout CommandType