asp.net.ph

OleDbCommand Constructor ( String, OleDbConnection )

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

Parameters

cmdText
The text of the query.
connection
An OleDbConnection that represents the connection to a data source.

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