SlideShare a Scribd company logo
1 of 30
Working with ADO.NET

Objectives
In this lesson, you will learn to:
Identify the need for ADO.NET
Identify the features of ADO.NET
Identify the components of the ADO.NET object model
Connect to a database by creating a data adapter
Access a database through a dataset
Preview the data adapter result




   ©NIIT                        Working with ADO.NET/Lesson 5/Slide 1 of 30
Working with ADO.NET

ADO.NET
 Is a model used by Visual Basic .NET applications to
  communicate with a database for retrieving, accessing, and
  updating data.
 Uses a structured process flow to interact with a database.




   ©NIIT                     Working with ADO.NET/Lesson 5/Slide 2 of 30
Working with ADO.NET

Features of ADO.NET
 Disconnected data architecture — Applications connect to
  the database only while retrieving and updating data.
 Data cached in datasets — ADO.NET is based on a
  disconnected data structure. Therefore, the data is retrieved
  and stored in datasets.
 Data transfer in XML format — ADO.NET uses XML for
  transferring information from a database into a dataset and
  from the dataset to another component.
 Interaction with the database is done through data
  commands.



   ©NIIT                      Working with ADO.NET/Lesson 5/Slide 3 of 30
Working with ADO.NET

Just a Minute…
List the features of ADO.NET.




   ©NIIT                    Working with ADO.NET/Lesson 5/Slide 4 of 30
Working with ADO.NET

ADO.NET Object Model


                                               DATA PROVIDER

                                                               Establishes
                                                               connection with
                                                               the database
                                                CONNECTION
                                                               Retrieves data in a
          VISUAL           Accessing                               read-only,
          BASIC .NET       retrieved data                      forward only mode
          APPLICATION                           DATA READER
          (WINDOWS/                                            Executes a
          WEB FORM)                                            command to retrieve
                                                               data from the       DATABASE

                                                 COMMAND       database

                 Accessing retrieved                           Transfers data to
                 data                                          the dataset and
                                                               reflects the
                        Filling dataset with                   changes made in
                        data                                   the dataset to the
           DATASET
                                               DATA ADAPTER    database




  ©NIIT                                          Working with ADO.NET/Lesson 5/Slide 5 of 30
Working with ADO.NET

ADO.NET Object Model (Contd.)
Data from a database can be assessed through:
    A dataset
    A DataReader object




  ©NIIT                    Working with ADO.NET/Lesson 5/Slide 6 of 30
Working with ADO.NET

Key Components of the ADO.NET Model
Data Provider
    Is used for connecting to a database, retrieving data,
     and storing the data.
    Is of two types:
          ® OLE   DB data provider
          ® SQL   Server data provider




  ©NIIT                         Working with ADO.NET/Lesson 5/Slide 7 of 30
Working with ADO.NET

Just a Minute…
Identify the two types of data providers and list the difference
between them.




   ©NIIT                       Working with ADO.NET/Lesson 5/Slide 8 of 30
Working with ADO.NET

Components of a Data Provider
Connection
    Used to establish a connection with a data source
    Some commonly used properties and methods:
           ® ConnectionString   property
           ® Open()method

           ® Close()method

           ® State   property




   ©NIIT                          Working with ADO.NET/Lesson 5/Slide 9 of 30
Working with ADO.NET

Components of a Data Provider (Contd.)
Data adapter
    Creates a dataset and updates the database.
    Handles data transfer between the database and the
     dataset through its properties and methods.
    Displays the data through the process of table mapping.
    Are of two types:
           ® SqlDataAdapter

           ® OleDbDataAdapter




   ©NIIT                        Working with ADO.NET/Lesson 5/Slide 10 of 30
Working with ADO.NET

Just a Minute…
What is the function of a data adapter?




   ©NIIT                     Working with ADO.NET/Lesson 5/Slide 11 of 30
Working with ADO.NET

Components of a Data Provider (Contd.)
Data command
    Is a SQL statement or a stored procedure that is used to
     retrieve, insert, delete, or modify data from a data
     source.
    Is an object of the OleDbCommand or SQLCommand
     class.




   ©NIIT                    Working with ADO.NET/Lesson 5/Slide 12 of 30
Working with ADO.NET

Components of a Data Provider (Contd.)
Data reader
    Is used to retrieve data from a data source in a
     read-only and forward-only mode.
    Stores a single row at a time in the memory.
    Commonly used methods:
           ® Read()

           ® Close()

           ® NextResult()




   ©NIIT                    Working with ADO.NET/Lesson 5/Slide 13 of 30
Working with ADO.NET

Dataset
Is a disconnected, cached set of records that are retrieved
       from a database.
Is present as a DataSet class in the System.Data
namespace.
Has its own object model.




   ©NIIT                     Working with ADO.NET/Lesson 5/Slide 14 of 30
Working with ADO.NET

Dataset Object Model


                                           DATASET




          DataRelationCollection     DataTableCollection          ExtendedProperties




                 DataRelation            DataTable




            DataRowCollection      DataView          PrimaryKey       DataColumnCollection




                   DataRow                                              DataColumn




  ©NIIT                                           Working with ADO.NET/Lesson 5/Slide 15 of 30
Working with ADO.NET

Just a Minute…
What are the various components of a dataset?




   ©NIIT                   Working with ADO.NET/Lesson 5/Slide 16 of 30
Working with ADO.NET

Problem Statement 5.D.1
The call center application needs to provide the facility of
viewing the customer details for the Sales department.




   ©NIIT                      Working with ADO.NET/Lesson 5/Slide 17 of 30
Working with ADO.NET

Task List
Identify the data that needs to be displayed.
Identify the method for creating a data adapter.
Identify the type of dataset to be created.
Create a data adapter.
Create a dataset.
Preview the database records.




   ©NIIT                     Working with ADO.NET/Lesson 5/Slide 18 of 30
Working with ADO.NET

Task 1: Identify the data that needs to be displayed.
Result:
As per the given problem statement, the data to be
displayed is as follows:
     CustID
     FName
     LName
     Address
     Phone
     email


   ©NIIT                   Working with ADO.NET/Lesson 5/Slide 19 of 30
Working with ADO.NET

Task 2: Identify the method for creating a data
adapter.
There are three methods to create a data adapter:
    Manually
    Through a wizard
    Using the Server Explorer window
Result:
In the given problem statement, you will create a data
adapter by using Data Adapter Configuration Wizard since it
  lets you create a data adapter with minimum steps.



   ©NIIT                    Working with ADO.NET/Lesson 5/Slide 20 of 30
Working with ADO.NET

Just a Minute…
What are the different methods of creating a data adapter?




   ©NIIT                    Working with ADO.NET/Lesson 5/Slide 21 of 30
Working with ADO.NET

Task 3: Identify the type of dataset to be created.
Datasets are of two types:
    Typed
    Untyped
Typed dataset
    Is derived from the DataSet class and has an
     associated XML schema, which is created at the time of
     the creation of the dataset.
    Can be customized after creation.
    Supports Intellisense and auto‑completion for the
     elements of the syntax while writing code.

   ©NIIT                      Working with ADO.NET/Lesson 5/Slide 22 of 30
Working with ADO.NET

Task 3: Identify the type of dataset to be created.
  (Contd.)
 Untyped dataset
    Does not have any associated XML schema, therefore,
     the structure of an untyped dataset is not known at the
     compile time.
    Represents tables and columns as collections.
    Does not support Intellisense and auto‑completion for
     the elements of the syntax.
Result:
 Since the structure of the data is known at compile time,
  you will create a typed dataset for the given problem
  statement.

   ©NIIT                     Working with ADO.NET/Lesson 5/Slide 23 of 30
Working with ADO.NET

Just a Minute…
What is the difference between typed and untyped dataset?




   ©NIIT                   Working with ADO.NET/Lesson 5/Slide 24 of 30
Working with ADO.NET

Task 4: Create a data adapter.
Task 5: Create a dataset.
Task 6: Preview the database records.




  ©NIIT                 Working with ADO.NET/Lesson 5/Slide 25 of 30
Working with ADO.NET

Problem Statement 5.P.1
An application needs to be created that allows the Diaz
Telecommunications Sales Manager to preview the customer
order details from the database. In addition, for each order,
percentage of the cost of a product given as advance needs to
be previewed.




   ©NIIT                    Working with ADO.NET/Lesson 5/Slide 26 of 30
Working with ADO.NET

Summary
In this lesson, you learned that:
ADO.NET is a data access programming model for
accessing the data stored in a database from a .NET
application.
ADO.NET has the following features:
     A disconnected data architecture
     Data cached in datasets
     The use of XML format for data transfer
     Database operations done through data commands



   ©NIIT                      Working with ADO.NET/Lesson 5/Slide 27 of 30
Working with ADO.NET

Summary (Contd.)
 ADO.NET consists of the following components:
    Data Provider — Used for connecting to a database,
     retrieving data, storing the data in a dataset, and
     updating the database.
    Data Adapter — A data adapter is integral to the
     working of the ADO.NET model since data transfer to
     and from the database is done through a data adapter.
    Dataset — A dataset is a disconnected cached set of
     records that are retrieved from the database.
 A data adapter communicates with a database through data
       commands. These data commands use parameters for
       execution.
  ©NIIT                    Working with ADO.NET/Lesson 5/Slide 28 of 30
Working with ADO.NET

Summary (Contd.)
After a dataset has been created, a data adapter uses the
       process of table mapping to map the columns in the
       database table with the dataset columns.
A data adapter can be created by using any of the following
      methods:
    Manually
    Through a wizard
    By using Server Explorer




   ©NIIT                    Working with ADO.NET/Lesson 5/Slide 29 of 30
Working with ADO.NET

Summary (Contd.)
Datasets are of two types:
    Typed datasets – A typed dataset is derived from the
     DataSet class and has an associated schema.
    Untyped datasets – An untyped dataset does not have
     any associated XML schema. The tables and columns
     in an untyped dataset are represented as collections.




   ©NIIT                      Working with ADO.NET/Lesson 5/Slide 30 of 30

More Related Content

What's hot

Ado.net session10
Ado.net session10Ado.net session10
Ado.net session10Niit Care
 
Vb.net session 05
Vb.net session 05Vb.net session 05
Vb.net session 05Niit Care
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#Michael Heron
 
An overview of fragmentation
An overview of fragmentationAn overview of fragmentation
An overview of fragmentationcsandit
 

What's hot (9)

Ado.net session10
Ado.net session10Ado.net session10
Ado.net session10
 
Vb.net session 05
Vb.net session 05Vb.net session 05
Vb.net session 05
 
Ado.net
Ado.netAdo.net
Ado.net
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#
 
Unit4
Unit4Unit4
Unit4
 
Intake 38 10
Intake 38 10Intake 38 10
Intake 38 10
 
An overview of fragmentation
An overview of fragmentationAn overview of fragmentation
An overview of fragmentation
 

Viewers also liked

Viewers also liked (6)

Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
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
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NET
 

Similar to Vb net xp_05

Visual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetVisual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetFaRid Adwa
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaSonu Vishwakarma
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!rommel_gagasa
 
Jdbc Lecture5
Jdbc Lecture5Jdbc Lecture5
Jdbc Lecture5phanleson
 
Session 7 Bai 7 ve winform
Session 7 Bai 7 ve winformSession 7 Bai 7 ve winform
Session 7 Bai 7 ve winformmrtom16071980
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworksLuis Goldster
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1Mahmoud Ouf
 
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...ANIL MAHADEV
 
IBM DB2 App Development with Microsoft Visual C#
IBM DB2 App Development with Microsoft Visual C#IBM DB2 App Development with Microsoft Visual C#
IBM DB2 App Development with Microsoft Visual C#ANIL MAHADEV
 
1 introduction
1   introduction1   introduction
1 introductionNgeam Soly
 
Asp net interview_questions
Asp net interview_questionsAsp net interview_questions
Asp net interview_questionsGhazi Anwar
 
Asp net interview_questions
Asp net interview_questionsAsp net interview_questions
Asp net interview_questionsBilam
 
Guidelines data cite_denmark_ver3
Guidelines data cite_denmark_ver3Guidelines data cite_denmark_ver3
Guidelines data cite_denmark_ver3DTU Library
 
Guidelines data cite_denmark_ver2
Guidelines data cite_denmark_ver2Guidelines data cite_denmark_ver2
Guidelines data cite_denmark_ver2DTU Library
 
Dao pattern
Dao patternDao pattern
Dao patternciriako
 

Similar to Vb net xp_05 (20)

Visual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetVisual Basic.Net & Ado.Net
Visual Basic.Net & Ado.Net
 
Ado
AdoAdo
Ado
 
Introduction to ado.net
Introduction to ado.netIntroduction to ado.net
Introduction to ado.net
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu Vishwakarma
 
unit 3.docx
unit 3.docxunit 3.docx
unit 3.docx
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
Jdbc Lecture5
Jdbc Lecture5Jdbc Lecture5
Jdbc Lecture5
 
Session 7 Bai 7 ve winform
Session 7 Bai 7 ve winformSession 7 Bai 7 ve winform
Session 7 Bai 7 ve winform
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworks
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1
 
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...
 
IBM DB2 App Development with Microsoft Visual C#
IBM DB2 App Development with Microsoft Visual C#IBM DB2 App Development with Microsoft Visual C#
IBM DB2 App Development with Microsoft Visual C#
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
Ado .net
Ado .netAdo .net
Ado .net
 
1 introduction
1   introduction1   introduction
1 introduction
 
Asp net interview_questions
Asp net interview_questionsAsp net interview_questions
Asp net interview_questions
 
Asp net interview_questions
Asp net interview_questionsAsp net interview_questions
Asp net interview_questions
 
Guidelines data cite_denmark_ver3
Guidelines data cite_denmark_ver3Guidelines data cite_denmark_ver3
Guidelines data cite_denmark_ver3
 
Guidelines data cite_denmark_ver2
Guidelines data cite_denmark_ver2Guidelines data cite_denmark_ver2
Guidelines data cite_denmark_ver2
 
Dao pattern
Dao patternDao pattern
Dao pattern
 

More from Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 
Dacj 1-3 b
Dacj 1-3 bDacj 1-3 b
Dacj 1-3 b
 
Dacj 1-3 a
Dacj 1-3 aDacj 1-3 a
Dacj 1-3 a
 

Recently uploaded

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 

Recently uploaded (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 

Vb net xp_05

  • 1. Working with ADO.NET Objectives In this lesson, you will learn to: Identify the need for ADO.NET Identify the features of ADO.NET Identify the components of the ADO.NET object model Connect to a database by creating a data adapter Access a database through a dataset Preview the data adapter result ©NIIT Working with ADO.NET/Lesson 5/Slide 1 of 30
  • 2. Working with ADO.NET ADO.NET Is a model used by Visual Basic .NET applications to communicate with a database for retrieving, accessing, and updating data. Uses a structured process flow to interact with a database. ©NIIT Working with ADO.NET/Lesson 5/Slide 2 of 30
  • 3. Working with ADO.NET Features of ADO.NET Disconnected data architecture — Applications connect to the database only while retrieving and updating data. Data cached in datasets — ADO.NET is based on a disconnected data structure. Therefore, the data is retrieved and stored in datasets. Data transfer in XML format — ADO.NET uses XML for transferring information from a database into a dataset and from the dataset to another component. Interaction with the database is done through data commands. ©NIIT Working with ADO.NET/Lesson 5/Slide 3 of 30
  • 4. Working with ADO.NET Just a Minute… List the features of ADO.NET. ©NIIT Working with ADO.NET/Lesson 5/Slide 4 of 30
  • 5. Working with ADO.NET ADO.NET Object Model DATA PROVIDER Establishes connection with the database CONNECTION Retrieves data in a VISUAL Accessing read-only, BASIC .NET retrieved data forward only mode APPLICATION DATA READER (WINDOWS/ Executes a WEB FORM) command to retrieve data from the DATABASE COMMAND database Accessing retrieved Transfers data to data the dataset and reflects the Filling dataset with changes made in data the dataset to the DATASET DATA ADAPTER database ©NIIT Working with ADO.NET/Lesson 5/Slide 5 of 30
  • 6. Working with ADO.NET ADO.NET Object Model (Contd.) Data from a database can be assessed through: A dataset A DataReader object ©NIIT Working with ADO.NET/Lesson 5/Slide 6 of 30
  • 7. Working with ADO.NET Key Components of the ADO.NET Model Data Provider Is used for connecting to a database, retrieving data, and storing the data. Is of two types: ® OLE DB data provider ® SQL Server data provider ©NIIT Working with ADO.NET/Lesson 5/Slide 7 of 30
  • 8. Working with ADO.NET Just a Minute… Identify the two types of data providers and list the difference between them. ©NIIT Working with ADO.NET/Lesson 5/Slide 8 of 30
  • 9. Working with ADO.NET Components of a Data Provider Connection Used to establish a connection with a data source Some commonly used properties and methods: ® ConnectionString property ® Open()method ® Close()method ® State property ©NIIT Working with ADO.NET/Lesson 5/Slide 9 of 30
  • 10. Working with ADO.NET Components of a Data Provider (Contd.) Data adapter Creates a dataset and updates the database. Handles data transfer between the database and the dataset through its properties and methods. Displays the data through the process of table mapping. Are of two types: ® SqlDataAdapter ® OleDbDataAdapter ©NIIT Working with ADO.NET/Lesson 5/Slide 10 of 30
  • 11. Working with ADO.NET Just a Minute… What is the function of a data adapter? ©NIIT Working with ADO.NET/Lesson 5/Slide 11 of 30
  • 12. Working with ADO.NET Components of a Data Provider (Contd.) Data command Is a SQL statement or a stored procedure that is used to retrieve, insert, delete, or modify data from a data source. Is an object of the OleDbCommand or SQLCommand class. ©NIIT Working with ADO.NET/Lesson 5/Slide 12 of 30
  • 13. Working with ADO.NET Components of a Data Provider (Contd.) Data reader Is used to retrieve data from a data source in a read-only and forward-only mode. Stores a single row at a time in the memory. Commonly used methods: ® Read() ® Close() ® NextResult() ©NIIT Working with ADO.NET/Lesson 5/Slide 13 of 30
  • 14. Working with ADO.NET Dataset Is a disconnected, cached set of records that are retrieved from a database. Is present as a DataSet class in the System.Data namespace. Has its own object model. ©NIIT Working with ADO.NET/Lesson 5/Slide 14 of 30
  • 15. Working with ADO.NET Dataset Object Model DATASET DataRelationCollection DataTableCollection ExtendedProperties DataRelation DataTable DataRowCollection DataView PrimaryKey DataColumnCollection DataRow DataColumn ©NIIT Working with ADO.NET/Lesson 5/Slide 15 of 30
  • 16. Working with ADO.NET Just a Minute… What are the various components of a dataset? ©NIIT Working with ADO.NET/Lesson 5/Slide 16 of 30
  • 17. Working with ADO.NET Problem Statement 5.D.1 The call center application needs to provide the facility of viewing the customer details for the Sales department. ©NIIT Working with ADO.NET/Lesson 5/Slide 17 of 30
  • 18. Working with ADO.NET Task List Identify the data that needs to be displayed. Identify the method for creating a data adapter. Identify the type of dataset to be created. Create a data adapter. Create a dataset. Preview the database records. ©NIIT Working with ADO.NET/Lesson 5/Slide 18 of 30
  • 19. Working with ADO.NET Task 1: Identify the data that needs to be displayed. Result: As per the given problem statement, the data to be displayed is as follows: CustID FName LName Address Phone email ©NIIT Working with ADO.NET/Lesson 5/Slide 19 of 30
  • 20. Working with ADO.NET Task 2: Identify the method for creating a data adapter. There are three methods to create a data adapter: Manually Through a wizard Using the Server Explorer window Result: In the given problem statement, you will create a data adapter by using Data Adapter Configuration Wizard since it lets you create a data adapter with minimum steps. ©NIIT Working with ADO.NET/Lesson 5/Slide 20 of 30
  • 21. Working with ADO.NET Just a Minute… What are the different methods of creating a data adapter? ©NIIT Working with ADO.NET/Lesson 5/Slide 21 of 30
  • 22. Working with ADO.NET Task 3: Identify the type of dataset to be created. Datasets are of two types: Typed Untyped Typed dataset Is derived from the DataSet class and has an associated XML schema, which is created at the time of the creation of the dataset. Can be customized after creation. Supports Intellisense and auto‑completion for the elements of the syntax while writing code. ©NIIT Working with ADO.NET/Lesson 5/Slide 22 of 30
  • 23. Working with ADO.NET Task 3: Identify the type of dataset to be created. (Contd.) Untyped dataset Does not have any associated XML schema, therefore, the structure of an untyped dataset is not known at the compile time. Represents tables and columns as collections. Does not support Intellisense and auto‑completion for the elements of the syntax. Result: Since the structure of the data is known at compile time, you will create a typed dataset for the given problem statement. ©NIIT Working with ADO.NET/Lesson 5/Slide 23 of 30
  • 24. Working with ADO.NET Just a Minute… What is the difference between typed and untyped dataset? ©NIIT Working with ADO.NET/Lesson 5/Slide 24 of 30
  • 25. Working with ADO.NET Task 4: Create a data adapter. Task 5: Create a dataset. Task 6: Preview the database records. ©NIIT Working with ADO.NET/Lesson 5/Slide 25 of 30
  • 26. Working with ADO.NET Problem Statement 5.P.1 An application needs to be created that allows the Diaz Telecommunications Sales Manager to preview the customer order details from the database. In addition, for each order, percentage of the cost of a product given as advance needs to be previewed. ©NIIT Working with ADO.NET/Lesson 5/Slide 26 of 30
  • 27. Working with ADO.NET Summary In this lesson, you learned that: ADO.NET is a data access programming model for accessing the data stored in a database from a .NET application. ADO.NET has the following features: A disconnected data architecture Data cached in datasets The use of XML format for data transfer Database operations done through data commands ©NIIT Working with ADO.NET/Lesson 5/Slide 27 of 30
  • 28. Working with ADO.NET Summary (Contd.) ADO.NET consists of the following components: Data Provider — Used for connecting to a database, retrieving data, storing the data in a dataset, and updating the database. Data Adapter — A data adapter is integral to the working of the ADO.NET model since data transfer to and from the database is done through a data adapter. Dataset — A dataset is a disconnected cached set of records that are retrieved from the database. A data adapter communicates with a database through data commands. These data commands use parameters for execution. ©NIIT Working with ADO.NET/Lesson 5/Slide 28 of 30
  • 29. Working with ADO.NET Summary (Contd.) After a dataset has been created, a data adapter uses the process of table mapping to map the columns in the database table with the dataset columns. A data adapter can be created by using any of the following methods: Manually Through a wizard By using Server Explorer ©NIIT Working with ADO.NET/Lesson 5/Slide 29 of 30
  • 30. Working with ADO.NET Summary (Contd.) Datasets are of two types: Typed datasets – A typed dataset is derived from the DataSet class and has an associated schema. Untyped datasets – An untyped dataset does not have any associated XML schema. The tables and columns in an untyped dataset are represented as collections. ©NIIT Working with ADO.NET/Lesson 5/Slide 30 of 30