Working with ADO.NETObjectivesIn this lesson, you will learn to:Identify the need for ADO.NETIdentify the features of ADO....
Working with ADO.NETADO.NET Is a model used by Visual Basic .NET applications to  communicate with a database for retrievi...
Working with ADO.NETFeatures of ADO.NET Disconnected data architecture — Applications connect to  the database only while ...
Working with ADO.NETJust a Minute…List the features of ADO.NET.   ©NIIT                    Working with ADO.NET/Lesson 5/S...
Working with ADO.NETADO.NET Object Model                                               DATA PROVIDER                      ...
Working with ADO.NETADO.NET Object Model (Contd.)Data from a database can be assessed through:    A dataset    A DataReade...
Working with ADO.NETKey Components of the ADO.NET ModelData Provider    Is used for connecting to a database, retrieving d...
Working with ADO.NETJust a Minute…Identify the two types of data providers and list the differencebetween them.   ©NIIT   ...
Working with ADO.NETComponents of a Data ProviderConnection    Used to establish a connection with a data source    Some c...
Working with ADO.NETComponents of a Data Provider (Contd.)Data adapter    Creates a dataset and updates the database.    H...
Working with ADO.NETJust a Minute…What is the function of a data adapter?   ©NIIT                     Working with ADO.NET...
Working with ADO.NETComponents of a Data Provider (Contd.)Data command    Is a SQL statement or a stored procedure that is...
Working with ADO.NETComponents of a Data Provider (Contd.)Data reader    Is used to retrieve data from a data source in a ...
Working with ADO.NETDatasetIs a disconnected, cached set of records that are retrieved       from a database.Is present as...
Working with ADO.NETDataset Object Model                                           DATASET          DataRelationCollection...
Working with ADO.NETJust a Minute…What are the various components of a dataset?   ©NIIT                   Working with ADO...
Working with ADO.NETProblem Statement 5.D.1The call center application needs to provide the facility ofviewing the custome...
Working with ADO.NETTask ListIdentify the data that needs to be displayed.Identify the method for creating a data adapter....
Working with ADO.NETTask 1: Identify the data that needs to be displayed.Result:As per the given problem statement, the da...
Working with ADO.NETTask 2: Identify the method for creating a dataadapter.There are three methods to create a data adapte...
Working with ADO.NETJust a Minute…What are the different methods of creating a data adapter?   ©NIIT                    Wo...
Working with ADO.NETTask 3: Identify the type of dataset to be created.Datasets are of two types:    Typed    UntypedTyped...
Working with ADO.NETTask 3: Identify the type of dataset to be created.  (Contd.) Untyped dataset    Does not have any ass...
Working with ADO.NETJust a Minute…What is the difference between typed and untyped dataset?   ©NIIT                   Work...
Working with ADO.NETTask 4: Create a data adapter.Task 5: Create a dataset.Task 6: Preview the database records.  ©NIIT   ...
Working with ADO.NETProblem Statement 5.P.1An application needs to be created that allows the DiazTelecommunications Sales...
Working with ADO.NETSummaryIn this lesson, you learned that:ADO.NET is a data access programming model foraccessing the da...
Working with ADO.NETSummary (Contd.) ADO.NET consists of the following components:    Data Provider — Used for connecting ...
Working with ADO.NETSummary (Contd.)After a dataset has been created, a data adapter uses the       process of table mappi...
Working with ADO.NETSummary (Contd.)Datasets are of two types:    Typed datasets – A typed dataset is derived from the    ...
Upcoming SlideShare
Loading in...5
×

Vb net xp_05

354

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
354
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Vb net xp_05

  1. 1. Working with ADO.NETObjectivesIn this lesson, you will learn to:Identify the need for ADO.NETIdentify the features of ADO.NETIdentify the components of the ADO.NET object modelConnect to a database by creating a data adapterAccess a database through a datasetPreview the data adapter result ©NIIT Working with ADO.NET/Lesson 5/Slide 1 of 30
  2. 2. Working with ADO.NETADO.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. 3. Working with ADO.NETFeatures 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. 4. Working with ADO.NETJust a Minute…List the features of ADO.NET. ©NIIT Working with ADO.NET/Lesson 5/Slide 4 of 30
  5. 5. Working with ADO.NETADO.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. 6. Working with ADO.NETADO.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. 7. Working with ADO.NETKey Components of the ADO.NET ModelData 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. 8. Working with ADO.NETJust a Minute…Identify the two types of data providers and list the differencebetween them. ©NIIT Working with ADO.NET/Lesson 5/Slide 8 of 30
  9. 9. Working with ADO.NETComponents of a Data ProviderConnection 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. 10. Working with ADO.NETComponents 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. 11. Working with ADO.NETJust a Minute…What is the function of a data adapter? ©NIIT Working with ADO.NET/Lesson 5/Slide 11 of 30
  12. 12. Working with ADO.NETComponents 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. 13. Working with ADO.NETComponents 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. 14. Working with ADO.NETDatasetIs a disconnected, cached set of records that are retrieved from a database.Is present as a DataSet class in the System.Datanamespace.Has its own object model. ©NIIT Working with ADO.NET/Lesson 5/Slide 14 of 30
  15. 15. Working with ADO.NETDataset 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. 16. Working with ADO.NETJust a Minute…What are the various components of a dataset? ©NIIT Working with ADO.NET/Lesson 5/Slide 16 of 30
  17. 17. Working with ADO.NETProblem Statement 5.D.1The call center application needs to provide the facility ofviewing the customer details for the Sales department. ©NIIT Working with ADO.NET/Lesson 5/Slide 17 of 30
  18. 18. Working with ADO.NETTask ListIdentify 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. 19. Working with ADO.NETTask 1: Identify the data that needs to be displayed.Result:As per the given problem statement, the data to bedisplayed is as follows: CustID FName LName Address Phone email ©NIIT Working with ADO.NET/Lesson 5/Slide 19 of 30
  20. 20. Working with ADO.NETTask 2: Identify the method for creating a dataadapter.There are three methods to create a data adapter: Manually Through a wizard Using the Server Explorer windowResult:In the given problem statement, you will create a dataadapter 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. 21. Working with ADO.NETJust a Minute…What are the different methods of creating a data adapter? ©NIIT Working with ADO.NET/Lesson 5/Slide 21 of 30
  22. 22. Working with ADO.NETTask 3: Identify the type of dataset to be created.Datasets are of two types: Typed UntypedTyped 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. 23. Working with ADO.NETTask 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. 24. Working with ADO.NETJust a Minute…What is the difference between typed and untyped dataset? ©NIIT Working with ADO.NET/Lesson 5/Slide 24 of 30
  25. 25. Working with ADO.NETTask 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. 26. Working with ADO.NETProblem Statement 5.P.1An application needs to be created that allows the DiazTelecommunications Sales Manager to preview the customerorder details from the database. In addition, for each order,percentage of the cost of a product given as advance needs tobe previewed. ©NIIT Working with ADO.NET/Lesson 5/Slide 26 of 30
  27. 27. Working with ADO.NETSummaryIn this lesson, you learned that:ADO.NET is a data access programming model foraccessing the data stored in a database from a .NETapplication.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. 28. Working with ADO.NETSummary (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. 29. Working with ADO.NETSummary (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. 30. Working with ADO.NETSummary (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

×