System.Data.OleDb Namespace OleDbCommand Class
Initializes a new instance of the OleDbCommand class.
1. Initializes a new instance of the OleDbCommand class.
2. Initializes a new instance of the OleDbCommand class with the text of the query.
3. Initializes a new instance of the OleDbCommand class with the text of the query and an OleDbConnection.
4. Initializes a new instance of the OleDbCommand class with the text of the query, an OleDbConnection, and the Transaction.
The following example initializes an OleDbCommand and sets some of its properties.
NOTE: This example uses one of the overloaded versions of the OleDbCommand constructor. For other examples that may be available, see the individual overload topics.
OleDbConnection myConn = new OleDbConnection
( "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=Northwind.mdb" );
myConn.Open ( );
OleDbTransaction myTrans = myConn.BeginTransaction ( );
string query = "SELECT * FROM Categories ORDER BY CategoryID";
OleDbCommand myCommand = new OleDbCommand ( query, myConn, myTrans );
Dim myConn As New OleDbConnection _
( "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=Northwind.mdb" )
myConn.Open ( )
Dim myTrans As OleDbTransaction = myConn.BeginTransaction ( )
Dim query As String = "SELECT * FROM Categories ORDER BY CategoryID"
Dim myCommand As new OleDbCommand ( query, myConn, myTrans ) |
|
C# |
VB |
OleDbCommand Members