If you’re new to the world of ASP.NET development or even just .NET development in general you’ve probably heard of ADO.NET at some point. The ironic part about ADO.NET is that it is utilized in probably 99% of applications yet it is rarely discussed as its own entity. ADO.NET simply sits and hides in the background and does its job.
ADO.NET is not a part of ASP.NET; it is a part of the .NET framework as a whole and represents the data source connectivity layer of the .NET framework. It can be used from either ASP.NET or WinForms applications in the same manner. In fact you could theoretically take the data tier from an N-tier application built for ASP.NET and apply it to a WinForms application without changing a single line of code. This is the fundamental principle behind a reusable framework. ADO.NET provides the building blocks for data source access and manipulation in an abstract fashion and can be applied to any application type in the .NET framework.
Now you might be wondering about the title of this tutorial, if ADO.NET is merely a data source connectivity framework, how can it be used to build an application? The truth is it can’t, but ADO.NET does make up the data source interaction layer of any .NET application, and in our case we’ll use it to build the data tier in an ASP.NET sample application.
The purpose of this tutorial is not to focus on the ASP.NET portion of the .NET framework. This means we will not focus on user interface, forms, authentication and so forth, but instead we will try to take common requirements in a web application and use ADO.NET to provide those requirements.
Sometimes when working in a development team there would be dedicated developers who build strictly the data tiers and the interface developers use the functionality provided to build the user interface. Other times one single developer works from the database up, providing all functionality.
For this tutorial we will examine 2 approaches. During part 1 we will explore the scenario where a single developer builds everything from the database up in a 2-tier design by utilizing the data wizards of the data controls designed for ASP.NET WebForms. During part 2 we will explore how to provide the same features in an N-tier application with a more robust dedicated data tier, linking to the user interface of ASP.NET WebForms.
The approach we will take will not be focused on a real world application with properly laid out interfaces, but rather real world ‘scenarios’ that you will likely encounter everyday as a developer. Since ADO.NET isn’t an integral part of the user experience or interface we need to explore common development situations and how to solve them.
Note: Visual Studio .NET running ASP.NET ver 1.x is required for this tutorial. Access to SQL Server is not required but preferred, you must have access to a database however in order to properly implement the sample code. Both VB.NET and C# code samples will be provided