OleDbCommand Constructor (String)

 

Initializes a new instance of the OleDbCommand class with the text of the query.

Namespace:   System.Data.OleDb
Assembly:  System.Data (in System.Data.dll)

public OleDbCommand(
	string cmdText
)

Parameters

cmdText
Type: System.String

The text of the query.

The following table shows initial property values for an instance of OleDbCommand.

Properties

Initial Value

CommandText

cmdText

CommandTimeout

30

CommandType

Text

Connection

null

The following example creates an OleDbCommand and sets some of its properties.

public void CreateMyOleDbCommand() 
{
   string queryString = "SELECT * FROM Categories ORDER BY CategoryID";
   OleDbCommand command = new OleDbCommand(queryString);
   command.CommandTimeout = 20;
}

.NET Framework
Available since 1.1
Return to top
Show: