Transcript

Session 7

Slide 1 of 13

04/13/23

Introduction to ADO.NET

Slide 2 of 26

04/13/23

Module Introduction This module will explain the role of ActiveX Data Objects.NET (ADO.NET) in providing data access for the .NET-based applications. The module also explains about the different data providers that allow you to establish and maintain connection with the database.

Slide 3 of 26

04/13/23

What is database? A database is a collection of related records. The information in the database is stored in such a way that it is easier to access, manage, and update the data. Data from the database can be accessed using any one of the following architectures:

+ Single-tier Architecture+ Two-tier Architecture+ Three-tier Architecture

Slide 4 of 26

04/13/23

ADO.NET AD0.NET is the data access technology, which allows you to access data residing in various data sources. ADO.NET is a part of the .NET Framework, which means that the technology can be used for all .NET-based applications.

ADO.NET technology allows you to connect to database systems such as Microsoft SQL Server, Oracle, Microsoft Access, and Sybase.

Slide 5 of 26

04/13/23

Data Access Architecture ADO.NET data access model and its components are used for processing the data in a database. The two important components of ADO.NET are data providers and Data sets.

Slide 6 of 26

04/13/23

Connected Data Access ADO uses connected data access approach. In this approach, connection to a database is established when requested by an application. This connection is kept open till the application is closed.

Slide 7 of 26

04/13/23

Disconnected Data Access

Slide 8 of 26

04/13/23

Data Provider

"System.Data" Namespace

Slide 9 of 26

04/13/23

Data Access ComponentsADO.NET provides two components to access and manipulate data:

+ .NET Framework data providers+ The DataSet

- The .NET Framework data providers are components which allow manipulating data, and giving read-only access to data.- DataSet is designed for accessing data independent of any data source.

Slide 10 of 26

04/13/23

Slide 11 of 26

04/13/23

DataSet Datasets are used to display and update data. It can be used for retrieving data from multiple sources. Datasets support the disconnected data access approach. This means the connection to the original database is established only while retrieving and updating data in the database. After that, the connection is automatically closed.

Slide 12 of 26

04/13/23

"Connection" Object The Connection object allows you to create a connection between your application and the database.

Slide 13 of 26

04/13/23

"SqlConnection" Class

Slide 14 of 26

04/13/23

"Command" Object The Command object stores and executes SQL commands across a data connection. The Command object allows you to make a call to a stored procedure. It can be used to execute SQL statements such as UPDATE, DELETE, INSERT, or SELECT.

For executing commands on SQL Server the System.Data.SqlClient.SqlCommand is used

Slide 15 of 26

04/13/23

"Command" Object Classes

Slide 16 of 26

04/13/23

"DataAdapter" Object The DataAdapter object acts as a bridge between a dataset and a data source. This object updates the database to match it with the data in dataset. It uses the Fill() method to fill the dataset with the data from data source.

Slide 17 of 26

04/13/23

"DataReader" Object

top related