Session 7 Bai 7 ve winform

17
Session 7 Slide 1 of 13 06/15/22 Introduction to ADO.NET

Transcript of Session 7 Bai 7 ve winform

Page 1: Session 7 Bai 7 ve winform

Session 7

Slide 1 of 13

04/13/23

Introduction to ADO.NET

Page 2: Session 7 Bai 7 ve winform

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.

Page 3: Session 7 Bai 7 ve winform

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

Page 4: Session 7 Bai 7 ve winform

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.

Page 5: Session 7 Bai 7 ve winform

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.

Page 6: Session 7 Bai 7 ve winform

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.

Page 7: Session 7 Bai 7 ve winform

Slide 7 of 26

04/13/23

Disconnected Data Access

Page 8: Session 7 Bai 7 ve winform

Slide 8 of 26

04/13/23

Data Provider

"System.Data" Namespace

Page 9: Session 7 Bai 7 ve winform

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.

Page 10: Session 7 Bai 7 ve winform

Slide 10 of 26

04/13/23

Page 11: Session 7 Bai 7 ve winform

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.

Page 12: Session 7 Bai 7 ve winform

Slide 12 of 26

04/13/23

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

Page 13: Session 7 Bai 7 ve winform

Slide 13 of 26

04/13/23

"SqlConnection" Class

Page 14: Session 7 Bai 7 ve winform

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

Page 15: Session 7 Bai 7 ve winform

Slide 15 of 26

04/13/23

"Command" Object Classes

Page 16: Session 7 Bai 7 ve winform

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.

Page 17: Session 7 Bai 7 ve winform

Slide 17 of 26

04/13/23

"DataReader" Object