asp.net.ph

OleDbDataAdapter.SelectCommand Property

System.Data.OleDb Namespace   OleDbDataAdapter Class


Sets or retrieves an SQL statement used to select records in the data source.

[ VB ]
Public Property SelectCommand As OleDbCommand

[ C# ]
public OleDbCommand SelectCommand {get; set;}

[ C++ ]
public: __property OleDbCommand* get_SelectCommand ( );
public: __property void set_SelectCommand ( OleDbCommand* );

[ C++ ]
public function get SelectCommand ( ) : OleDbCommand;
public function set SelectCommand ( OleDbCommand );

Property Value

An OleDbCommand that is used during Fill to select records from data source for placement in the DataSet.

Remarks

When SelectCommand is assigned to a previously created OleDbCommand, the OleDbCommand is not cloned. The SelectCommand maintains a reference to the previously created OleDbCommand object.

If the SelectCommand does not return any rows, no tables are added to the DataSet, and no exception is raised.

Example

The following example initializes an OleDbDataAdapter and sets some of its properties.

OleDbDataAdapter myDataAdapter = new OleDbDataAdapter ( );
myDataAdapter.SelectCommand.CommandText = 
   "SELECT * FROM Products ORDER BY ProductID";
myDataAdapter.SelectCommand.Connection.ConnectionString = 
   "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=gear.mdb";
  C# VB

See Also

OleDbDataAdapter Members   DeleteCommand   InsertCommand   UpdateCommand 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