System.Data.OleDb Namespace OleDbDataAdapter Class
Initializes a new instance of the OleDbDataAdapter class with the specified OleDbCommand object.
[ VB ]
Overloads Public Sub New ( _
ByVal selectCommand As OleDbCommand _
)
[ C# ]
public OleDbDataAdapter (
OleDbCommand selectCommand
);
[ C++ ]
public: OleDbDataAdapter (
OleDbCommand* selectCommand
);
[ JScript ]
public function OleDbDataAdapter (
selectCommand : OleDbCommand
);
- selectCommand
- An OleDbCommand that is an SQL SELECT statement or stored procedure. This OleDbCommand is internally set as the SelectCommand property of the OleDbDataAdapter.
When an instance of OleDbDataAdapter is created, the following read/write properties are set to initial values.
You can change the value of any of these properties through a separate call to the property.
When SelectCommand ( or any of the other command properties ) is assigned to a previously created OleDbCommand, the OleDbCommand is not cloned. The SelectCommand maintains a reference to the previously created OleDbCommand object.
The following example initializes an OleDbDataAdapter using this constructor, then fills a DataSet.
// set up the connection
string connString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" +
Server.MapPath ( "~/app_data/dbtutor.mdb" );
// set up an OleDbCommand
OleDbCommand myCommand = new OleDbCommand (
"SELECT * FROM Products", connString );
// set up the dataadapter
OleDbDataAdapter myAdapter = new OleDbDataAdapter ( myCommand );
// instantiate a dataset object
DataSet mydata = new DataSet ( );
// fill with query results
myAdapter.Fill ( myData, "products" );
' set up the connection
dim connString as string = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" +
Server.MapPath ( "~/app_data/dbtutor.mdb" )
' set up an OleDbCommand
dim myCommand as new OleDbCommand ( _
"SELECT * FROM Products", connString )
' set up the dataadapter
dim myAdapter as new OleDbDataAdapter ( myCommand )
' instantiate a dataset object
DataSet mydata = new DataSet ( )
' fill with query results
myAdapter.Fill ( myData, "products" ) |
|
C# |
VB |
OleDbDataAdapter Members OleDbDataAdapter Constructor Overload List MissingMappingAction MissingSchemaAction