System.Data.OleDb Namespace OleDbDataAdapter Class
Initializes a new instance of the OleDbDataAdapter class.
1. Initializes a new instance of the OleDbDataAdapter class.
2. Initializes a new instance of the OleDbDataAdapter class with the specified OleDbCommand object.
3. Initializes a new instance of the OleDbDataAdapter class with the specified SQL SELECT statement and a connection string.
4. Initializes a new instance of the OleDbDataAdapter class with the specified SQL SELECT statement and an OleDbConnection object.
The following example initializes an OleDbDataAdapter, then fills a DataSet.
NOTE: This example uses one of the overloaded versions of the OleDbDataAdapter constructor. For other examples that may be available, see the individual overload topics.
// set up the connection
string connString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" +
Server.MapPath ( "~/app_data/dbtutor.mdb" );
// set up the query
string query = "SELECT * FROM Products";
// set up the adapter
OleDbDataAdapter myAdapter = new OleDbDataAdapter ( query, connString );
// instantiate 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 the query
dim query as string = "SELECT * FROM Products";
' set up the adapter
dim myAdapter as new OleDbDataAdapter ( query, connString )
' instantiate dataset object
dim myData as new DataSet ( )
' fill with query results
myAdapter.Fill ( myData, "products" ) |
|
C# |
VB |
OleDbDataAdapter Members