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 );
An OleDbCommand that is used during Fill to select records from data source for placement in the DataSet.
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.
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";
Dim myDataAdapter As 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 |
OleDbDataAdapter Members DeleteCommand InsertCommand UpdateCommand