Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 10.  Communicating with ADO.NET



Refresh my memory. How can I switch from the SQL managed provider to the OLE DB provider?


At the simplest, all you need to do is replace all OleDb prefixes with Sql, making sure you import the System.Data.SqlClient namespace, and possibly updating your connection string to work with SQL. Other than that, there are some slight differences in the two providers, but in everyday situations, these changes will suffice.


Are the OleDbDataAdapter and OleDbCommand objects completely different? Why are there two different objects?


The OleDbDataAdapter is a more abstract version of the OleDbCommand object. When you set the SelectCommand, UpdateCommand, InsertCommand, and DeleteCommand methods, ADO.NET is actually creating new OleDbCommand objects. These objects are used to interface with the data store to execute SQL commands. Using an OleDbDataAdapter simply allows you to place the results in a DataSet (as well as use TableMappings).

You can think of the OleDbDataAdapter object as a high-level object, while the OleDbCommand object is a low-level object that interacts directly with databases.


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: