objective in this session we will discuss about : 1.what is ado. net ? 2.assembly used in ado.net...

Post on 22-Dec-2015

215 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Objective

In this session we will discuss about :

1. What is ADO. NET ?

2. Assembly used in ADO.NET

3. Namespace used in ADO.NET

4. What is the full form of ADO?

5. What are major difference between classic ADO and ADO.NET?

6. ADO.NET Components

7. NET Framework Data Provider

What is ADO. NET ?

• ADO. NET provides a bridge between the front end controls and the back end

database.

Continue…• ADO.NET is a set of classes that expose data access services for .NET Framework

programmers.

• ADO.NET provides data access services in the Microsoft .NET platform.

• ADO.NET provides consistent access to data sources such as SQL Server and XML,

and to data sources exposed through OLE DB and ODBC.

• Data-sharing consumer applications can use ADO.NET to connect to these data

sources and retrieve, handle, and update the data that they contain.

• ADO.NET includes .NET Framework data providers for connecting to a database,

executing commands, and retrieving results.

Assembly used in ADO.NET

• The ADO.NET classes are found in System.Data.dll, and are integrated with the XML

classes found in System.Xml.dll.

• ADO.NET is a set of computer software components that programmers can use to

access data and data services based on disconnected DataSets and XML.

Namespace used in ADO.NET

Disconnected

Connect

ed

What is the full form of ADO?• The full form of ADO is ActiveX Data Object.

Features of ADO.NET

1. Contains a number of classes that provide you with various methods and attributes

to manage the communication between your application and data source.

2. Enables you to access different data sources, such as Microsoft SQL Server, and

XML, as per your requirements.

3. Provides a rich set of features, such as connection and commands that can be used

to develop robust and highly efficient data services in .NET applications.

4. Provides various data providers that are specific to databases produced by various

vendors.

For example, ADO.NET has a separate provider to access data from Oracle

databases; whereas, another provider is used to access data from SQL databases.

What are major difference between classic ADO and ADO.NET?

• In ADO we have recordset and in ADO.NET we have dataset.

• In recordset we can only have one table.

• If we want to accommodate more than one tables. We need to do inner join and fill

the recordset.

• Dataset can have multiple tables.

• All data persist in XML as compared to classic ADO where data persisted in Binary

format also.

ADO.NET Components• The two main components of ADO.NET 3.0 for accessing and manipulating data are

the .NET Framework data providers and the DataSet.

Data providers Data Set

.NET Framework Data Provider

Data provider• An ADO.NET data provider is a software component that interacts with a data

source.

• It is required for :

1. Connecting to a database.

2. Retrieving data.

3. Storing the data in a dataset.

4. Reading the retrieved data.

5. Updating the database.

List of Data provider

Continue…

.NET Framework Data Provider for SQL Server (SqlClient)

.NET Framework Data Provider for OLE DB

.NET Framework Data Provider for ODBC

.NET Framework Data Provider for Oracle

Core Objects of .NET Framework Data Providers

Creating and Managing Connections

• To create and manage connections, you need to:

1. Create a connection object.

2. Create a command object.

3. Open the connection object.

4. Execute the SQL statement in the command object.

5. Close the connection object.

SqlConnection Class

Ex

SqlCommand

Continue…

Ex

Adding Parameters to Commands

Command Using Stored Procedures

SqlCommand run a stored procedure that takes a parameter

Data Reader

Ex

Data Adapter

Continue…

Continue…• The DataAdapter object serves as a conduit between the data source and the

Dataset.

• The DataAdapter knows about the DataSet and it knows how to populate it.

Continue…

Ex

Continue…

Summary!!

top related