Presentation is loading. Please wait.

Presentation is loading. Please wait.

DEV383 The ADO.NET DataSet and You Jackie Goldstein General Manager Renaissance Computer Systems

Similar presentations


Presentation on theme: "DEV383 The ADO.NET DataSet and You Jackie Goldstein General Manager Renaissance Computer Systems"— Presentation transcript:

1 DEV383 The ADO.NET DataSet and You Jackie Goldstein General Manager Renaissance Computer Systems jackie@renaissance.co.il

2 Jackie Goldstein… General Manager of Renaissance Computer Systems General Manager of Renaissance Computer Systems – Consulting, Training, & Development, with Microsoft Tools & Technologies Author of “Database Access with Visual Basic.Net” Author of “Database Access with Visual Basic.Net” (ISBN 0-67232-3435, Addison-Wesley, Q3 2002) (ISBN 0-67232-3435, Addison-Wesley, Q3 2002) MSDN Regional Director for Israel MSDN Regional Director for Israel Founder and monthly host of IVBUG (Israel Visual Basic User Group) Founder and monthly host of IVBUG (Israel Visual Basic User Group) Speaker at local & international developer conferences: Speaker at local & international developer conferences: – Microsoft Developer Days, TechEd, – VSLive!, VBITS, VB DevCon, SQL2TheMax Selected as SME (Subject Matter Expert) to help develop/review content for DevDays 2000 and DevDays 2001 with Microsoft team in Redmond Selected as SME (Subject Matter Expert) to help develop/review content for DevDays 2000 and DevDays 2001 with Microsoft team in Redmond

3 Session Topics “Here You Come Again” “Here You Come Again” – A Quick Review “Alone Again (Naturally)” “Alone Again (Naturally)” – The Basics: Tables, Relations, & Constraints “One, Twice, Three Times a Lady” “One, Twice, Three Times a Lady” – 3 Ways to Configure the DataAdapter “I Can See Clearly Now” “I Can See Clearly Now” – Data Views and DataRowViewState “Love Will Keep Us Together” “Love Will Keep Us Together” – Multi-Table Reads and Updates “We Can Work it Out” “We Can Work it Out” – Concurrency Conflicts Questions and Summary Questions and Summary

4 Data In The.NET Platform.NET Data Provider DataReader Command Connection Sync Controls, Designers, Code-gen, etc DataSet XmlReader XmlText-ReaderXmlNode-Reader XSL/T, X-Path, Validation, etc XmlData- Document Data-Adapter

5 Points to Note in ADO.NET vs. ADO Separation between connected data access model and disconnected programming model Separation between connected data access model and disconnected programming model No CursorType, CursorLocation, or LockType No CursorType, CursorLocation, or LockType ADO Recordset functionality is split into smaller, specific objects, e.g. DataReader, DataTable, Command ADO Recordset functionality is split into smaller, specific objects, e.g. DataReader, DataTable, Command ADO.NET allows manipulation of XML data, not just XML as I/O format ADO.NET allows manipulation of XML data, not just XML as I/O format

6 DataSet Object DataSet DataTable DataTable DataRow DataColumn Relations Constraints XML Schema

7 DataAdapter Object DataAdapter SelectCommand InsertCommand UpdateCommand DeleteCommand TableMappings Database DataSet

8 “Alone Again (Naturally)” The Basics: Tables, Relations, & Constraints Programmatic definition and access of a DataSet’s Tables, Relations, and Constraints (without any database) Programmatic definition and access of a DataSet’s Tables, Relations, and Constraints (without any database) – Using only code – Using the DataSet Component Demo!

9 “One, Twice, Three Times a Lady” 3 Ways to Configure the DataAdapter The CommandBuilder Object The CommandBuilder Object Explicit Code Explicit Code The DataAdapter Configuration Wizard The DataAdapter Configuration Wizard Demo!

10 “I Can See Clearly Now” Data Views and DataRowViewState Multiple simultaneous views of the same DataSet data, filtered and sorted by DataRowViewState Multiple simultaneous views of the same DataSet data, filtered and sorted by DataRowViewState Demo!

11 “Love Will Keep Us Together” Multi-Table Reads and Updates The standard methods of generating update command for the DataAdapter (CommandBuilder and DataAdapter Configuration Wizard) support only single-table updates The standard methods of generating update command for the DataAdapter (CommandBuilder and DataAdapter Configuration Wizard) support only single-table updates How do I do multi-table reads and updates ? How do I do multi-table reads and updates ?

12 “Love Will Keep Us Together” Multi-Table Reads and Updates Use Batch SQL / Stored Procedures to load multiple DataSet tables in one server round-trip Use Batch SQL / Stored Procedures to load multiple DataSet tables in one server round-trip Use ExecuteXmlReader to fetch hierarchical data and load into DataSet Use ExecuteXmlReader to fetch hierarchical data and load into DataSet Update multiple tables using a Stored Procedure Update multiple tables using a Stored Procedure Issue multiple update commands by calling the Update methods of the individual DataAdapters Issue multiple update commands by calling the Update methods of the individual DataAdapters

13 “Love Will Keep Us Together” Multi-Table Updates Generally update related tables in the following order: Generally update related tables in the following order: 1.Child Table: Delete Records 2.Parent Table: Insert, Update, and Delete records 3.Child Table: Insert and Update records

14 “Love Will Keep Us Together” Multi-Table Reads and Updates Read multiple tables into the DataSet in a single round-trip to the database server Read multiple tables into the DataSet in a single round-trip to the database server Update the database with changes to multiple tables Update the database with changes to multiple tables Demo!

15 “We Can Work it Out” Concurrency Conflicts Why Optimistic Locking ? Why Optimistic Locking ? Conflict Detection Conflict Detection Conflict Resolution Conflict Resolution – DataSet maintains 3 views of field value: Original, Current, and Proposed (during edit) Original, Current, and Proposed (during edit) – Can force changes, reject changes, or reject changes and reload data from source

16 What defines a conflict ? ADO 2.X – Dynamic Property “Update Criteria” ADO 2.X – Dynamic Property “Update Criteria” – adCriteriaUpdCols (default) – adCriteriaAllCols – adCriteriaTimeStamp – adCriteriaKey ADO.NET ADO.NET – Auto-generated commands include PK and all fields in UPDATE and DELETE statements – Developer can specify own custom SQL statements (e.g. if 2 of the 5 columns were modified).

17 Differences in ADO.NET Can be automatically generated (but with limitations) Can be automatically generated (but with limitations) Greater flexibility in defining what constitutes a conflict (see previous slide) Greater flexibility in defining what constitutes a conflict (see previous slide) A little more manual code required A little more manual code required – Passing different versions of columns – Retrieving current database values More flexibility in handling batches with one or more conflicts More flexibility in handling batches with one or more conflicts

18 “We Can Work it Out” Concurrency Conflicts Detecting and resolving concurrency conflicts Detecting and resolving concurrency conflicts Demo!

19 Summary The DataSet (and its associated objects) provides very flexible data manipulation The DataSet (and its associated objects) provides very flexible data manipulation The DataAdapter provides flexible and powerful batch update support The DataAdapter provides flexible and powerful batch update support The DataView allows multiple simultaneous views of the same DataSet data The DataView allows multiple simultaneous views of the same DataSet data Dig into the details ! Dig into the details !

20 Titles and Artists “Here You Come Again” “Here You Come Again” – Dolly Parton “Alone Again (Naturally)” “Alone Again (Naturally)” – Gilbert O’ Sullivan “One, Twice, Three Times a Lady” “One, Twice, Three Times a Lady” – The Commodores “I Can See Clearly Now” “I Can See Clearly Now” – Johnny Nash “Love Will Keep Us Together” “Love Will Keep Us Together” – The Captain & Tennille “We Can Work it Out” “We Can Work it Out” – The Beatles

21 Questions?

22 Don’t forget to complete the on-line Session Feedback form on the Attendee Web site https://web.mseventseurope.com/teched/ https://web.mseventseurope.com/teched/

23


Download ppt "DEV383 The ADO.NET DataSet and You Jackie Goldstein General Manager Renaissance Computer Systems"

Similar presentations


Ads by Google