Introduction to ADO.NET
Microsoft .NET Framework developers routinely use ADO.NET to access data stored in a wide variety of formats, but ADO.NET isn't a programming language or a database management system. So what is ADO.NET and how can you use it to access data stored in nearly any standard format? Read on to find out.
What is ADO.NET
To understand what ADO.NET is you need to be familiar with the Microsoft .NET Framework. The .NET Framework is a software framework primarily intended for use on Microsoft Windows computers. The framework includes support for lots of different programming languages such as ASP.NET, C#, and Visual Basic, and a wide variety of data storage formats.
.NET applications are typically developed in Visual Studio, a .NET integrated development environment (IDE) from Microsoft. However, a few alternatives are available, most notably SharpDevelop.
Since multiple database systems and data storage formats can be used within the .NET framework, a single common way of accessing data in a variety of database systems and across multiple programming languages is extremely helpful. ADO.NET is that common method for accessing data stored in a variety of different formats using any supported programming language. For example, you can use ADO.NET to map data stored in the following ways:
- In a SQL Server database;
- In any format accessible using the Object Linking and Embedding, Database (OLE DB) application programming interface (API);
- In any format accessible using the Open Database Connectivity (ODBC) API;
- In an Oracle database.
Consumers and Providers
To better understand ADO.NET, it helpful to think of the conceptual model on which ADO.NET is built: data consumers and data providers.
- Data consumers are the applications that need access to data in order to perform their purpose. Data consumers are things like web application, mobile apps, and desktop applications.
- Data providers are the data sources that contain the data the applications needs to access. Data providers include relational databases, spreadsheets, access databases and many other data sources.
ADO.NET is set of Microsoft .NET Framework software development tools used to build bridges between data consumers and data providers that can be called using any supported programming language and used to pull data out of any supported data storage format.
ADO vs. ADO.NET
If you've been doing your homework, you may know that ActiveX Data Objects (ADO) is another way of accessing data when programming in ASP, Delphi, PowerBuilder, and dBase. You probably already know that ADO is somewhat outdated at this point while ADO.NET is not, but what are the real tangible differences between ADO and ADO.NET? There are at least two major differences:
- ADO is used to access data using the OLE DB API. ASP.NET can be used to access data using OLE DB as well as several other methods.
- ADO represents data in a
recordsetwhile ADO.NET represents data in a
dataset. ADO.NET datasets preserve the original structure of data much better than ADO recordsets. As a result, datasets are capable of holding much richer data than recordsets.
In most cases, the IDE you're using or the original programming language of the software you're manipulating will dictate whether you use ADO or ADO.NET, but if you happen to have the option, pick ADO.NET.
Google ado.net and you'll find no shortage of results. However, much of what you find will be badly outdated or of marginal quality. To make life easier for you, we've taken the time to sift through the available resources and pull together the most useful ADO.NET references, tutorials, online courses, and texts.
Microsoft Developer Network
The Microsoft Developer Network (MSDN) offers an extensive ADO.NET referrence library. Specific topics include an ADO.NET overview, using ADO.NET to access data stored in a SQL Server database such as MS SQL, ADO.NET code examples, and much more.
If you're an experienced .NET developer looking for information about a specific ADO.NET topic, MSDN is the best place to find it. However, if you're new to .NET or ADO.NET, some of the tutorials and online courses that follow will provide a more gentle introduction to this often confusing topic.
Tutorials and Articles
A Beginner's Tutorial for Understanding ADO.NET, available from Code Project, will help you understand the basics of using ADO.NET. This tutorial walks through the process of pulling information from a SQL Server database for a simple web application, but the concepts presented can be applied to pull data from any type of data store.
If you're programming using ASP.NET and want a quick crash-course on using
datarow properties and methods, the Tutorials Point ASP.NET - ADO.NET Tutorial covers the basics without excessive hand-holding. Another tutorial in the same vein from Tutorials Point, VB.Net — Database Access, covers a lot of the same ground for developers working with Visual Basic.
C#Corner offers many articles and tutorials covering a wide range of ADO.NET topics. While the quality of C#Corner's member-submitted content varies significantly from one resource to the next, two of the most useful tutorials include Basics of ADO.NET and ADO.NET : In Depth Tutorial.
There are lots of online courses that will teach you all about the different parts of the .NET Framework and include information about accessing data using ADO.NET. However, if what you're really looking for are courses that target ADO.NET try these first:
- Asp.Net And Ado.Net From Scratch
- Mastering ASP.NET and ADO.NET with C#
- ADO.Net | Let's Begin your Era of Programming
- ADO.NET by Example
- ADO.NET Fundamentals
Textbooks and Printed Reference Guides
Most texts that cover ADO.NET do so in the broader context of the .NET Framework or a specific language such as C#. These are some of the most respected and well-reviewed texts that cover ADO.NET as well as some of these broader associated topics:
- C# 6.0 and the .NET 4.6 Framework by Troelsen and Japikse
- Microsoft ADO.NET 4 Step by Step by Tim Patrick
- Programming Entity Framework: Building Data Centric Apps with the ADO.NET Entity Framework by Julia Lerman
- ADO.NET 3.5 Cookbook by Bill Hamilon
- Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars
The .NET Framework is designed to make it easy to use multiple programming languages and data storage formats. ADO.NET is a critical part of the .NET Framework that makes it possible to use any .NET Framework programming language to work with data stored in a wide variety of formats without having to learn the details specific to each data format. Learning how to use ADO.NET software tools is a critical step in building bridges between data consuming applications and the data providing stores that feed them.
Further Reading and Resources
We have more guides, tutorials, and infographics related to coding and development:
- Microsoft Visual Basic / Visual Studio: this is our basic primer on Visual Studio with a focus on Visual Basic.
- SQL Resources: your first step in becoming a SQL expert.
- C# Resources: as one of the most popular languages in the .NET firmament, C# is very helpful to know.
What Code Should You Learn?
Confused about what programming language you should learn to code in? Check out our infographic, What Code Should You Learn? It not only discusses different aspects of the languages, it answers important questions such as, "How much money will I make programming Java for a living?"