asp.net.ph

OleDbDataAdapter Constructor ( String, String )

System.Data.OleDb Namespace   OleDbDataAdapter Class


Initializes a new instance of the OleDbDataAdapter with class the specified SQL SELECT statement and a connection string.

[ VB ]
Overloads Public Sub New ( _
   ByVal commandText As String, _
   ByVal connectString As String _
)

[ C# ]
public OleDbDataAdapter (
   string commandText,
   string connectString
);

[ C++ ]
public: OleDbDataAdapter (
   String* commandText,
   String* connectString
);

[ JScript ]
public function OleDbDataAdapter (
   commandText : String,
   connectString : String
);

Parameters

commandText
String specifying an SQL SELECT statement or stored procedure.
connectString
The connection string.

Remarks

When an instance of OleDbDataAdapter is created, the following read/write properties are set to initial values.


Properties Initial Value
MissingMappingAction MissingMappingAction.Passthrough
MissingSchemaAction MissingSchemaAction.Add

You can change the value of any of these properties through a separate call to the property.

Example

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 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" );
  C# VB

See Also

OleDbDataAdapter Members   OleDbDataAdapter Constructor Overload List   MissingMappingAction   MissingSchemaAction 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