Connected and Disconnected Data Access Architecture

The ADO.NET Framework encompasses two distinct models of Data Access Architecture: Connection Oriented Data Access Architecture and Disconnected Data Access Architecture.

In Connection Oriented Data Access Architecture, the application establishes a connection with the Data Source and subsequently interacts with it by issuing SQL requests through the same connection. This approach entails the application remaining connected to the database system even when it is not actively engaged in performing any Database Operations.

To address this challenge, ADO.NET introduces a novel component known as the Dataset. Within the ADO.NET Disconnected Data Access Architecture, the Dataset assumes a central role. It serves as an in-memory data store capable of housing multiple tables simultaneously. Notably, DataSets solely contain data and do not establish any direct interaction with a Data Source. A significant characteristic of the DataSet is its complete independence from the underlying Data Source, thereby lacking any knowledge of the specific Data Source used to populate it.

By employing the Dataset within the Disconnected Data Access Architecture, ADO.NET effectively resolves the aforementioned problem, enabling applications to operate seamlessly without maintaining constant connections to the database system. This approach allows for enhanced flexibility, improved performance, and reduced network overhead in scenarios where offline data access and manipulation are required.

Dim ds As New DataSet

In Connection Oriented Data Access, when retrieving data from a database using a DataReader object, it is essential to maintain an open connection between your application and the Data Source. However, in contrast to the DataReader, the DataSet is not directly connected to the Data Source through a Connection object during the population process.

Instead, the DataAdapter plays a crucial role in managing the connection between the Data Source and the DataSet. It facilitates the transfer of data from the Data Source to the DataSet, providing a disconnected behavior to the DataSet. Acting as a bridge, the DataAdapter enables seamless communication between the connected and disconnected components.

By utilizing the DataAdapter, the DataSet can be populated with data from the Data Source while maintaining independence from the live connection. The DataAdapter establishes and manages the necessary connections, retrieves the data from the Data Source, and populates the DataSet accordingly. Once the data is transferred, the connection can be closed, enabling the DataSet to function independently with the disconnected data.

This arrangement allows for efficient data retrieval, as the DataAdapter optimizes the process by handling the connection management tasks, data transfer, and synchronization between the Data Source and the DataSet. It provides a seamless transition between the connected and disconnected states, facilitating flexible data manipulation and offline access within the application.

Dim adapter As New SqlDataAdapter("sql", "connection") Dim ds As New DataSet adapter.Fill(ds, "Src Table")

By keeping connections open for only a minimum period of time, ADO .NET conserves system resources and provides maximum security for databases and also has less impact on system performance.

Conclusion

The DataAdapter plays a vital role in achieving a disconnected behavior for the DataSet within the Connection Oriented Data Access approach. It enables efficient data transfer and manages the connection between the Data Source and the DataSet, acting as a bridge between the connected and disconnected objects in ADO.NET.