VOOZH about

URL: https://www.geeksforgeeks.org/software-engineering/introduction-to-ado-net/

⇱ Introduction to ADO.NET - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Introduction to ADO.NET

Last Updated : 29 Mar, 2025

The .NET Framework includes its own data access technology, i.e., ADO.NET. ADO.NET is the latest implementation of Microsoft's Universal Data Access strategy. It consists of managed classes that allow .NET applications to connect to data sources such as Microsoft SQL Server, Microsoft Access, Oracle, XML, etc., execute commands, and manage disconnected data.

Microsoft ADO.NET is an improvement over ADO. ADO.NET was first introduced in the 1.0 version of the .NET Framework and provides a wide range of features to handle data in different modes, such as connected mode and disconnected mode. In connected mode, we deal with live data, while in disconnected mode, data is accessed from a stored source.

ADO.NET was primarily developed to address two common ways of working with data obtained from data sources:

  • The first approach involves accessing data once and iterating through it in a single instance, i.e., caching the data in runtime memory.
  • The second approach involves working with data in a connected manner, where data is not cached, and the application always queries the database to retrieve it.

Architecture of ADO.NET

ADO.NET uses a multilayered architecture that revolves around a few key concepts:

  • Connection
  • Command
  • DataSet objects

The architecture of ADO.NET differs slightly from ADO, as shown in the following figure (not included here).

One of the key differences between ADO and ADO.NET is how they handle various data sources. In ADO.NET, programmers use a generic set of objects regardless of the underlying data source.

For example: if we want to retrieve a record from an Oracle database, we use the same connection class that we would use with SQL Server. ADO.NET uses a data provider model along with the DataSet to achieve this flexibility.

Features of ADO.NET

Interoperability

XML documents are text-based formats, which means they can be edited using standard text-editing tools. ADO.NET uses XML for all data exchanges and for the internal representation of data.

Maintainability

ADO.NET is designed with a separation between data logic and the user interface. This allows developers to create applications in independent layers, making them easier to maintain.

Programmability (Typed Programming)

Typed programming is a style in which specific user-defined types are used to construct statements or evaluate expressions. For example, to select the "Marks" column for "Kawal" from the "Student" table, you would use:

DataSet.Student["Kawal"].Marks;

Performance

ADO.NET uses a disconnected data architecture, which reduces the load on the database and improves scalability. Since most operations are handled on the client-side, overall performance is enhanced.

Scalability

Scalability refers to the system's ability to handle an increasing number of clients without degrading performance. By using disconnected data access, applications do not retain database connections for long durations. This approach conserves resources and allows multiple users to access data simultaneously.

Comment
Article Tags:

Explore