SlideShare a Scribd company logo
1 of 18
By –Om Prakash Kumar
ADO.NET
The database access technologies we used, including components for
retrieving data, storing data in memory, and binding data to controls,
are collectively called ADO.NET .
ADO.NET is designed to provide a disconnected architecture
If the database needs to be updated with changes made to the in -
memory copy, a new connection is made and the database is updated
ADO.Net is a model, a part of the .Net framework that is used by the
.Net applications for retrieving, accessing and updating data.
System.Data -> The non provider specific (non database
aware classes) are
located in System.Data.
System.Data.SQLClient -> Managed Provider for SQL Server.
This gives the best performance for SQL Server running
directly over the SQL
Server Tabular Data Stream (TDS) protocol.
System.Data.OleDB -> Managed Provider for OleDB
Providers. This provides
access to any OleDB Provider.
ADO.NET Namespaces
ADO.NET is comprised of many classes, but five take center stage:
Connection - Represents a connection to a data source.
Command - Represents a query or a command that is to be executed by
a data source.
DataSet - Represents data. The DataSet can be filled either from a data
source (using a DataAdapter object) or dynamically.
DataAdapter - Used for filling a DataSet from a data source.
DataReader - Used for fast, efficient, forward-only reading of a data
source
ADO.NET
ADO.NET Architecture Diagram
Benefits of ADO.NET
 Interoperability through use of XML:
 Open standard for data that describes itself
 Human readable and decipherable text
 Used internally but accessible externally
 Can use XML to read and write and move data
 Scalability through the disconnected DataSet
 Connections are not maintained for long periods
 Database locking does not occur
 Locking support with ServiceComponents
 Optimistic locking otherwise
 Works the way the Web works: “Hit and Run!”
 Maintainability
 Separation of data logic and user interface
The data residing in a data store or database is
retrieved through the data provider. Various
components of the data provider, retrieves data for the
application and update data.
A data provider is used for connecting to a database,
executing commands and retrieving data, storing it in a
dataset, reading the retrieved data and updating the
database.
Data Provider
The data provider in ADO .NET consists of the following four objects:
1.) Connection:
This component is used to set up a connection with a data source.
2.) Command:
A command is a SQL statement or a stored procedure used to
retrieve, insert, delete or modify data in a data source.
Data Provider (Cont..)
3.) DataReader :
Data reader is used to retrieve data from a data source in a
read-only and forward-only mode.
4.) DataAdapter :
This is integral to the working of ADO.NET since data is
transferred to and from a database through a data
adapter. It retrieves data from a database into a dataset and
updates the database. When changes are made to
the dataset, the changes in the database are actually done
by the data adapter.
Cont ..
DataSet is an in-memory representation of data. It is a
disconnected, cached set of records that are retrieved from a
database.
The dataset works as a virtual database, containing tables, rows,
and columns.
The DataSet class is present in the System.Data namespace.
DataSet
The following are the components of DataSet :
1.) DataTableCollection:
It contains all the tables retrieved from the data source.
2 .)DataRelationCollection:
It contains relationships and the links between tables in a data set.
3 .)ExtendedProperties:
It contains additional information, like the SQL statement for retrieving
data, time of retrieval etc.
4 .)DataTable:
It represents a table in the DataTableCollection of a dataset. It consists of
the dataRow and dataColumn objects.
DataSet
5.) DataRelation:
It represents a relationship in the DataRelationshipCollection of the
dataset. It is used to relate two DataTable
objects to each other through the DataColumn objects.
6 .)DataRowCollection:
It contains all the rows in a DataTable.
7 .)DataView:
It represents a fixed customized view of a DataTable for sorting,
filtering, searching, editing and navigation.
8 .)PrimaryKey:
It represents the column that uniquely identifies a row in a
DataTable.
DataSet
9.) DataRow :
It represents a row in the DataTable. The DataRow object and its
properties and methods are used to retrieve, evaluate, insert,
delete, and update values in the DataTable. The NewRow method
is used to create a new row and the Add method adds a row to
the table.
10.) DataColumnCollection:
It represents all the columns in a DataTable.
11.) DataColumn:
It consists of the number of columns that comprise a DataTable.
DataSet
Data reader
The DataReader object is initially positioned just prior to the first
row of the result set (and
therefore has to be repositioned before reading any data).
The Read method repositions the DataReader to the next row,
returning True if the
DataReader is positioned onto a valid row and False if the
DataReader is positioned past the
last row in the result set.
The DataReader provides an Item property for reading column
values from the current row.
*SelectCommand
*contains a Command object that can be used to populate a DataTable within
DataSet
*Command object typically references a SQL SELECT statement
*InsertCommand
*to insert rows added to a DataTable into an underlying database
*Command object typically references a SQL INSERT statement
*UpdateCommand
*to update a database based on changes made to a DataTable
*Command object typically references a SQL UPDATE statement
*DeleteCommand
*to delete rows in a database based on deletions made to a DataTable
*Command object typically references a SQL DELETE statement
*
*Fill
*Used to execute a query (in the SelectCommand) and store the result in
a DataSet
*Da.Fill(Ds, “TableName”)
*Note that the connection can be closed once the Fill method is done
*Update
*Used to modify data in the database based on changes made to the
DataTables
TCS2111

More Related Content

What's hot

What's hot (20)

Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
 
5 collection framework
5 collection framework5 collection framework
5 collection framework
 
Data Structures - Lecture 3 [Arrays]
Data Structures - Lecture 3 [Arrays]Data Structures - Lecture 3 [Arrays]
Data Structures - Lecture 3 [Arrays]
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
 
Java Collections
Java  Collections Java  Collections
Java Collections
 
Adbms 11 object structure and type constructor
Adbms 11 object structure and type constructorAdbms 11 object structure and type constructor
Adbms 11 object structure and type constructor
 
Insertion operation in array(ds)
Insertion operation in array(ds)Insertion operation in array(ds)
Insertion operation in array(ds)
 
Delegates and events in C#
Delegates and events in C#Delegates and events in C#
Delegates and events in C#
 
STL in C++
STL in C++STL in C++
STL in C++
 
Java ArrayList Tutorial | Edureka
Java ArrayList Tutorial | EdurekaJava ArrayList Tutorial | Edureka
Java ArrayList Tutorial | Edureka
 
joins in database
 joins in database joins in database
joins in database
 
Chain of responsibility
Chain of responsibilityChain of responsibility
Chain of responsibility
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
 
Databind in asp.net
Databind in asp.netDatabind in asp.net
Databind in asp.net
 
standard template library(STL) in C++
standard template library(STL) in C++standard template library(STL) in C++
standard template library(STL) in C++
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
Data structures - unit 1
Data structures - unit 1Data structures - unit 1
Data structures - unit 1
 
L11 array list
L11 array listL11 array list
L11 array list
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Java collections concept
Java collections conceptJava collections concept
Java collections concept
 

Similar to Ado.net

Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
Harman Bajwa
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworks
Luis Goldster
 
Database programming in vb net
Database programming in vb netDatabase programming in vb net
Database programming in vb net
Zishan yousaf
 
LECTURE 14 Data Access.pptx
LECTURE 14 Data Access.pptxLECTURE 14 Data Access.pptx
LECTURE 14 Data Access.pptx
AOmaAli
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
Madhuri Kavade
 

Similar to Ado.net (20)

What is ado .net architecture_.pdf
What is ado .net architecture_.pdfWhat is ado .net architecture_.pdf
What is ado .net architecture_.pdf
 
Ado
AdoAdo
Ado
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
 
Disconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NETDisconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NET
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
ado.net
ado.netado.net
ado.net
 
Ado.net
Ado.netAdo.net
Ado.net
 
Introduction to ado.net
Introduction to ado.netIntroduction to ado.net
Introduction to ado.net
 
Csharp_dotnet_ADO_Net_database_query.pptx
Csharp_dotnet_ADO_Net_database_query.pptxCsharp_dotnet_ADO_Net_database_query.pptx
Csharp_dotnet_ADO_Net_database_query.pptx
 
Ado.net with asp.net
Ado.net with asp.netAdo.net with asp.net
Ado.net with asp.net
 
Ado
AdoAdo
Ado
 
Session x(ado.net)
Session x(ado.net)Session x(ado.net)
Session x(ado.net)
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworks
 
Database programming in vb net
Database programming in vb netDatabase programming in vb net
Database programming in vb net
 
Unit4
Unit4Unit4
Unit4
 
LECTURE 14 Data Access.pptx
LECTURE 14 Data Access.pptxLECTURE 14 Data Access.pptx
LECTURE 14 Data Access.pptx
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
Visual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetVisual Basic.Net & Ado.Net
Visual Basic.Net & Ado.Net
 
ADO.NET by ASP.NET Development Company in india
ADO.NET by ASP.NET  Development Company in indiaADO.NET by ASP.NET  Development Company in india
ADO.NET by ASP.NET Development Company in india
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

Ado.net

  • 2. ADO.NET The database access technologies we used, including components for retrieving data, storing data in memory, and binding data to controls, are collectively called ADO.NET . ADO.NET is designed to provide a disconnected architecture If the database needs to be updated with changes made to the in - memory copy, a new connection is made and the database is updated ADO.Net is a model, a part of the .Net framework that is used by the .Net applications for retrieving, accessing and updating data.
  • 3. System.Data -> The non provider specific (non database aware classes) are located in System.Data. System.Data.SQLClient -> Managed Provider for SQL Server. This gives the best performance for SQL Server running directly over the SQL Server Tabular Data Stream (TDS) protocol. System.Data.OleDB -> Managed Provider for OleDB Providers. This provides access to any OleDB Provider. ADO.NET Namespaces
  • 4. ADO.NET is comprised of many classes, but five take center stage: Connection - Represents a connection to a data source. Command - Represents a query or a command that is to be executed by a data source. DataSet - Represents data. The DataSet can be filled either from a data source (using a DataAdapter object) or dynamically. DataAdapter - Used for filling a DataSet from a data source. DataReader - Used for fast, efficient, forward-only reading of a data source ADO.NET
  • 6. Benefits of ADO.NET  Interoperability through use of XML:  Open standard for data that describes itself  Human readable and decipherable text  Used internally but accessible externally  Can use XML to read and write and move data  Scalability through the disconnected DataSet  Connections are not maintained for long periods  Database locking does not occur  Locking support with ServiceComponents  Optimistic locking otherwise  Works the way the Web works: “Hit and Run!”  Maintainability  Separation of data logic and user interface
  • 7. The data residing in a data store or database is retrieved through the data provider. Various components of the data provider, retrieves data for the application and update data. A data provider is used for connecting to a database, executing commands and retrieving data, storing it in a dataset, reading the retrieved data and updating the database. Data Provider
  • 8. The data provider in ADO .NET consists of the following four objects: 1.) Connection: This component is used to set up a connection with a data source. 2.) Command: A command is a SQL statement or a stored procedure used to retrieve, insert, delete or modify data in a data source.
  • 9. Data Provider (Cont..) 3.) DataReader : Data reader is used to retrieve data from a data source in a read-only and forward-only mode. 4.) DataAdapter : This is integral to the working of ADO.NET since data is transferred to and from a database through a data adapter. It retrieves data from a database into a dataset and updates the database. When changes are made to the dataset, the changes in the database are actually done by the data adapter.
  • 11. DataSet is an in-memory representation of data. It is a disconnected, cached set of records that are retrieved from a database. The dataset works as a virtual database, containing tables, rows, and columns. The DataSet class is present in the System.Data namespace. DataSet
  • 12. The following are the components of DataSet : 1.) DataTableCollection: It contains all the tables retrieved from the data source. 2 .)DataRelationCollection: It contains relationships and the links between tables in a data set. 3 .)ExtendedProperties: It contains additional information, like the SQL statement for retrieving data, time of retrieval etc. 4 .)DataTable: It represents a table in the DataTableCollection of a dataset. It consists of the dataRow and dataColumn objects. DataSet
  • 13. 5.) DataRelation: It represents a relationship in the DataRelationshipCollection of the dataset. It is used to relate two DataTable objects to each other through the DataColumn objects. 6 .)DataRowCollection: It contains all the rows in a DataTable. 7 .)DataView: It represents a fixed customized view of a DataTable for sorting, filtering, searching, editing and navigation. 8 .)PrimaryKey: It represents the column that uniquely identifies a row in a DataTable. DataSet
  • 14. 9.) DataRow : It represents a row in the DataTable. The DataRow object and its properties and methods are used to retrieve, evaluate, insert, delete, and update values in the DataTable. The NewRow method is used to create a new row and the Add method adds a row to the table. 10.) DataColumnCollection: It represents all the columns in a DataTable. 11.) DataColumn: It consists of the number of columns that comprise a DataTable. DataSet
  • 15. Data reader The DataReader object is initially positioned just prior to the first row of the result set (and therefore has to be repositioned before reading any data). The Read method repositions the DataReader to the next row, returning True if the DataReader is positioned onto a valid row and False if the DataReader is positioned past the last row in the result set. The DataReader provides an Item property for reading column values from the current row.
  • 16. *SelectCommand *contains a Command object that can be used to populate a DataTable within DataSet *Command object typically references a SQL SELECT statement *InsertCommand *to insert rows added to a DataTable into an underlying database *Command object typically references a SQL INSERT statement *UpdateCommand *to update a database based on changes made to a DataTable *Command object typically references a SQL UPDATE statement *DeleteCommand *to delete rows in a database based on deletions made to a DataTable *Command object typically references a SQL DELETE statement
  • 17. * *Fill *Used to execute a query (in the SelectCommand) and store the result in a DataSet *Da.Fill(Ds, “TableName”) *Note that the connection can be closed once the Fill method is done *Update *Used to modify data in the database based on changes made to the DataTables