A Quick Comparison of ADO and ADO.NET - Part I
page 2 of 5
by Devarticles.com
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 29457/ 72

Old versus New: ADO versus ASP.NET

In ADO 2.x we used one common set of classes to perform database connections, retrieve records, update data, execute stored procedures, etc. They were the ADO command, connection, error, field, parameter, property, record, recordset and stream classes.

In ADO.NET we have two sets of classes that we can use to access our data, depending on how that data is stored. Each of these classes is stored in a separate namespaces that clearly identifies them. To access data stored in an SQL Server database, we would use the classes that exist in the System.Data.SqlClient namespace. To access data stored in any other OLEDB accessible repository (such as Excel, MySQL, Access, and even SQL Server) we use the classes available under the System.Data.OleDb namespace.

[Note] If you're wondering why you can use both SQL and OleDb providers to access an SQL Server database, it's because the classes under the SqlClient namespace have been optimised to do so, where as the classed under the OleDb namespace are more generic, and therefore their performance isn't as good when working with SQL server. [End Note]

Here's a list of the namespaces that we use to access our data with ADO.NET:

  1. System.Data: The root class of the entire ADO.NET hierarchy, this namespace stores the generic data access classes and variables that are used by both the SqlClient and OleDb classes.
  2. System.Data.Common: Contains classes that data providers can use as base classes when implementing their own data access routines.
  3. System.Data.SqlClient: Contains the classes that we instantiate to access data stored in SQL Server databases.
  4. System.Data.SqlTypes: Data types including enumerations and constants that can be used when calling certain functions from the SqlClient namespace.
  5. System.Data.OleDb: Contains the classes that we instantiate to access data stored in OleDb compatible data repositories.

ADO.Net also defines several shared classes that are common to both the SqlClient and OleDb namespaces (i.e. can be used when we're working with either SQL server or any other OleDb provider). In ADO 2.x we used the recordset, command and stream classes to access data, but with ADO.NET we now have access to several new data access classes. These classes can be used to store, access, manipulate and relate data from one source to another. We will take a look at these later.

Let's now look at some examples of how we can access and manipulate our data using ASP/ADO and ASP.NET/ADO.NET. In the examples that follow I will be working with SQL server only.

View Entire Article

User Comments

Title: dasds   
Name: adsad
Date: 2012-05-17 1:23:37 AM
Title: Comparison of ADO ADO.NET   
Name: Anand Mehta
Date: 2012-04-08 12:44:36 AM
ADO works with connected data. This means that when you access data, such as viewing and updating data, it is real-time, with a connection being used all the time. This is barring, of course, you programming special routines to pull all your data into temporary tables.

ADO.NET uses data in a disconnected fashion. When you access data, ADO.NET makes a copy of the data using XML. ADO.NET only holds the connection open long enough to either pull down the data or to make any requested updates. This makes ADO.NET efficient to use for Web applications. It's also decent for desktop applications.

ADO has one main object that is used to reference data, called the Recordset object. This object basically gives you a single table view of your data, although you can join tables to create a new set of records. With ADO.NET, you have various objects that allow you to access data in various ways. The DataSet object will actually allow you to store the relational model of your database. This allows you to pull up customers and their orders, accessing/updating the data in each related table individually.

ADO allows you to create client-side cursors only, whereas ADO.NET gives you the choice of either using client-side or server-side cursors. In ADO.NET, classes actually handle the work of cursors. This allows the developer to decide which is best. For Internet development, this is crucial in creating efficient applications.

Whereas ADO allows you to persist records in XML format, ADO.NET allows you to manipulate your data using XML as the primary means. This is nice when you are working with other business applications and also helps when you are working with firewalls because data is passed as HTML and XML.
Title: Comment on this article   
Name: Bharat Bhushan
Date: 2010-05-07 6:57:02 AM
Thank You for this article on Differences between ado and ado.net.

Thanks Dude

Bharat Bhushan Sharma (Delhi)
Title: Excellent   
Name: Abraham Mathew
Date: 2007-06-04 5:33:52 AM
Excellent article . It will gives us a short description of all the aspects of ADO .Net

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-04-16 10:59:28 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search