asp.net.ph

OleDbCommand Constructor ( String, OleDbConnection, OleDbTransaction )

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
);

Parameters

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.

Remarks

The following table shows initial property values for an OleDbCommand instantiated with this constructor.

Properties Initial Value
CommandText cmdText
CommandTimeout 30
CommandType Text
Connection A new OleDbConnection that is the value for the connection parameter.

You can change the value for any of these parameters by setting the related property.

Example

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 );
  C# VB

See Also

OleDbCommand Members   OleDbCommand Constructor Overload List Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph