System.Data.OleDb Namespace OleDbCommand Class
Initializes a new instance of the OleDbCommand class with the text of the query and an OleDbConnection.
[ VB ]
Overloads Public Sub New ( _
ByVal cmdText As String, _
ByVal connection As OleDbConnection _
)
[ C# ]
public OleDbCommand (
string cmdText,
OleDbConnection connection
);
[ C++ ]
public: OleDbCommand (
String* cmdText,
OleDbConnection* connection
);
[ JScript ]
public function OleDbCommand (
cmdText : String,
connection : OleDbConnection
);
- cmdText
- The text of the query.
- connection
- An OleDbConnection that represents the connection to a data source.
The following table shows initial property values for an OleDbCommand instantiated with this constructor.
You can change the value for any of these parameters by setting the related property.
The following example initializes an OleDbCommand with a given query and connection object.
OleDbConnection myConn = new OleDbConnection
( "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=Northwind.mdb" );
myConn.Open ( );
string query = "SELECT * FROM Categories ORDER BY CategoryID";
OleDbCommand myCommand = new OleDbCommand ( query, myConn );
Dim myConn As New OleDbConnection _
( "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=Northwind.mdb" )
myConn.Open ( )
Dim query As String = "SELECT * FROM Categories ORDER BY CategoryID"
Dim myCommand As new OleDbCommand ( query, myConn ) |
|
C# |
VB |
OleDbCommand Members OleDbCommand Constructor Overload List