Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)

IOTA^_^    

Sams Teach Yourself ASP.NET in 21 Days, Second Edition

By Chris Payne

Table of Contents
Day 10.  Communicating with ADO.NET

Q&A

Q1:

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

A1:

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.

Q2:

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

A2:

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.


    IOTA^_^    
    Top

    Категории