asp.net.ph

OleDbDataAdapter Constructor ( OleDbCommand )

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
);

Parameters

selectCommand
An OleDbCommand that is an SQL SELECT statement or stored procedure. This OleDbCommand is internally set as the SelectCommand property of the OleDbDataAdapter.

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.

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.

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 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" );
  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