System.Data.OleDb Namespace OleDbCommand Class
Initializes a new instance of the OleDbCommand class with the text of the query, an OleDbConnection, and the Transaction.
[ VB ]
Overloads Public Sub New ( _
ByVal cmdText As String, _
ByVal connection As OleDbConnection _
ByVal transaction As OleDbTransaction _
)
[ C# ]
public OleDbCommand (
string cmdText,
OleDbConnection connection
OleDbTransaction transaction
);
[ C++ ]
public: OleDbCommand (
String* cmdText,
OleDbConnection* connection
OleDbTransaction* transaction
);
[ JScript ]
public function OleDbCommand (
cmdText : String,
connection : OleDbConnection
transaction : OleDbTransaction
);
- cmdText
- The text of the query.
- connection
- An OleDbConnection that represents the connection to a data source.
- transaction
- The transaction in which the OleDbCommand executes.
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, connection, and transaction objects.
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 OleDbCommand Constructor Overload List