Home arrow ADO.NET arrow Page 2 - A Practical Comparison of ADO and ADO.NET
ADO.NET

A Practical Comparison of ADO and ADO.NET


Since "classic" ASP's humble beginnings, ADO data access classes and methods have been re-written to form ADO.NET. In this article Joe looks at the differences (in terms of classes, methods, and calling conventions) that exist between ADO and ADO.NET. He provides several practical examples that show us how to evolve from using ADO with ASP to using ADO.NET with C# and ASP.NET.

Author Info:
By: Joe O'Donnell
Rating: 4 stars4 stars4 stars4 stars4 stars / 72
March 01, 2002
TABLE OF CONTENTS:
  1. · A Practical Comparison of ADO and ADO.NET
  2. · Old versus new: ADO versus ASP.NET
  3. · Connecting to a database
  4. · Working with recordsets/rowsets
  5. · Calling stored procedures
  6. · Retrieving records as XML
  7. · Conclusion

print this article
SEARCH DEVARTICLES

A Practical Comparison of ADO and ADO.NET - Old versus new: ADO versus ASP.NET
(Page 2 of 7 )

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:
  • 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.
  • System.Data.Common: Contains classes that data providers can use as base classes when implementing their own data access routines.
  • System.Data.SqlClient: Contains the classes that we instantiate to access data stored in SQL Server databases.
  • System.Data.SqlTypes: Data types including enumerations and constants that can be used when calling certain functions from the SqlClient namespace.
  • 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.
blog comments powered by Disqus
ADO.NET ARTICLES

- Datasets in Microsoft.Net
- Latest Developments in the .Net World
- Introduction to .NET
- Automatic Generation of Single Table SQL Sta...
- Data Access in .NET using C#: Part 1
- All You Need To Know About ADO.NET: Part 2/2
- All You Need To Know About ADO.NET: Part 1/2
- Easing Transition From ASP and ADO to ASP.NE...
- A Practical Comparison of ADO and ADO.NET

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials