SlideShare a Scribd company logo
1 of 21
CIS266

FINAL REVIEW
Use the DataSet object

 To transfer data between tiers
 To manipulate the data without an open
  connection
 To relate data from multiple sources
 To bind data to a Windows form
Referring to Records, Fields

 Actual data values are held in DataRow
  objects
   Each Table object in a dataset has a DataRows
    collection made up of DataRow objects
 Data values are held in the DataRow.Items
  collection
   Refer to fields by index position or by name (string
    value)
Setting a Relationship

 A DataRelation object describes the
  relationship between the tables.
 Use the XML schema (.xsd) file for the dataset
  to create the relationship – or – use code to
  create a relation
 DataRelation Object Functions
   Relating tables
   Setting up constraints
Retrieving Related Row(s)

 Use the GetParentRow method to retrieve
  the matching row from the table on the one
  side
 The GetChildRows method returns an array of
  rows from the many table
   May have 0, 1, or more related records
 Use Find method to find a row by its primary
  key value
DataRowState Enumeration

 Used for finding, accessing changed rows
 The HasChanges Method determines if
  changes have been made to a dataset
   Returns a boolean value
 The GetChanges Method is used to retrieve
  datatable rows that have changes
   Use an empty argument to retrieve all changed
    rows OR specify type of changes using
    enumeration values
The Binding Source

 Controls record position within a table
 Assures that all bound controls on a form
  display data from the same record
 Can bind controls in design time or in code
Binding Source Properties

 Position property holds the current row
  number (zero based)
 Count property indicates the number of
  records in a table
 The Current Property returns the current row
Binding Source Methods

 Binding Source Events
 The CurrentChanged event occurs when a
  bound value is changed
 The PositionChanged event occurs when a
  user navigates to another record
Adding an Event Handler

 An event handler executes automatically
  when an event occurs.
 Need to write event handlers for objects
  declared in code
   Write the procedure you want to execute when
    the event occurs, including the sender and
    eventargs arguments
   Add the handler in another procedure (such as
    constructor), which is called a delegate
     turns the general procedure written into an event
      procedure
DataRow Versions

 The DataRow object maintains several versions
  of its column data
   Current, Original, Default, Proposed
 If no changes have been made, the Current and
  Original versions are the same
 When EndEdit executes, the Current version is
  replaced by the Proposed
 The EndEdit method confirms the changes
 Changes are made when the AcceptChanges
  method executes
Changing Data

 Changes are made to the dataset, not to the
  original data source.
 Execute the data adapter’s Update method
  before calling the AcceptChanges method.
The AcceptChanges Method

 Calls the EndEdit method of the data row
 Removes all rows marked for deletion
 Makes the adds and edits indicated for the table
 Sets the Original version of each changed row to
  the Current version
 Sets RowState of each row to Unchanged
 The RejectChanges replaces Current versions
  with the Original versions
 After AcceptChanges or RejectChanges
  executes, all RowState properties are reset to
  Unchanged
Data Adapter Update Method

 Update writes the changes to the database
  using SQL action queries
 Uses a group of Command Objects
   One each for insert, update and delete
   Can use actual queries or refer to stored
    procedures
When to Update?

 Every time an add, edit, delete occurs?
 When the program terminates?
 Provide a Save option on a menu and prompt
  for unsaved changes when the program
  terminates?
Update Considerations

 Where does the application and data reside?
 How many users can make changes?
 Does the data source need to be up-to-date
  at all times?
Concurrency

 Concurrency control is the process of handling
  conflicts in updates by multiple users.
 Pessimistic concurrency control – a row is
  unavailable from the time the record is retrieved
  until the update is complete
 Optimistic concurrency control – a row is
  unavailable only while an update is in progress
  (default)
 “Last in wins” – A row is unavailable only when
  the update is being made.
Parent/Child Relationships

 To maintain referential integrity, update in
  the following order:
 Delete any child records
 Insert, update, and delete the parent records
 Insert and update the child records
Displaying Related Data

 Use a DataRelation
   Use GetChildRows/GetParentRow methods
   Use a Binding Source that uses a Datarelation as its
    datasource
 Filter rows by
   Using a For loop and adding to an array or datable
   Use table.Select method
 Requery database for related records
   Use Parameter Query; or
   Use a variable and build a Select statement with
    where clause
Stored Procedures

 Can store compiled SQL statement in
  database
   Helps reduce security threats
   Can reduce data passed across network
 Typically work directly with a command
  object
   Need to set command type
   Need to establish connection for command
Parameters

 Stored procedures accept and return values
  through parameters
   Input parameters are similar to arguments in
    procedural languages
 Command object has a parameters collection
  to specify parameters to use with stored
  procedure
 Can use parameters to pass criteria or values
  to edit rows

More Related Content

What's hot

asp.net data controls
asp.net data controlsasp.net data controls
asp.net data controls
subakrish
 
Stat2 25 09
Stat2 25 09Stat2 25 09
Stat2 25 09
stat
 

What's hot (20)

VISUAL BASIC .net data accesss vii
VISUAL BASIC .net data accesss viiVISUAL BASIC .net data accesss vii
VISUAL BASIC .net data accesss vii
 
ETL Validator Usecase - Validating Measures, Counts with Variance
ETL Validator Usecase - Validating Measures, Counts with VarianceETL Validator Usecase - Validating Measures, Counts with Variance
ETL Validator Usecase - Validating Measures, Counts with Variance
 
2310 b 09
2310 b 092310 b 09
2310 b 09
 
10 reasons to use analytics canvas for google analytics data in tableau
10 reasons to use analytics canvas for google analytics data in tableau10 reasons to use analytics canvas for google analytics data in tableau
10 reasons to use analytics canvas for google analytics data in tableau
 
asp.net data controls
asp.net data controlsasp.net data controls
asp.net data controls
 
Lesson 06 Styles and Templates in WPF
Lesson 06 Styles and Templates in WPFLesson 06 Styles and Templates in WPF
Lesson 06 Styles and Templates in WPF
 
Lesson 05 Data Binding in WPF
Lesson 05 Data Binding in WPFLesson 05 Data Binding in WPF
Lesson 05 Data Binding in WPF
 
ETL Validator Usecase - Data Profiling and Comparison
ETL Validator Usecase - Data Profiling and ComparisonETL Validator Usecase - Data Profiling and Comparison
ETL Validator Usecase - Data Profiling and Comparison
 
Lesson 09 Resources and Settings in WPF
Lesson 09 Resources and Settings in WPFLesson 09 Resources and Settings in WPF
Lesson 09 Resources and Settings in WPF
 
Stat2 25 09
Stat2 25 09Stat2 25 09
Stat2 25 09
 
ETL Validator Usecase - checking for LoV conformance
ETL Validator Usecase - checking for LoV conformanceETL Validator Usecase - checking for LoV conformance
ETL Validator Usecase - checking for LoV conformance
 
SAP BO Web Intelligence Basics
SAP BO Web Intelligence BasicsSAP BO Web Intelligence Basics
SAP BO Web Intelligence Basics
 
BI-Validator Usecase - Stress Test Plan
BI-Validator Usecase - Stress Test PlanBI-Validator Usecase - Stress Test Plan
BI-Validator Usecase - Stress Test Plan
 
Chapter.07
Chapter.07Chapter.07
Chapter.07
 
ETL Validator Usecase - Transformation logic in input data source
ETL Validator Usecase - Transformation logic in input data sourceETL Validator Usecase - Transformation logic in input data source
ETL Validator Usecase - Transformation logic in input data source
 
Analysis Of Attribute Revelance
Analysis Of Attribute RevelanceAnalysis Of Attribute Revelance
Analysis Of Attribute Revelance
 
How to view your website stats in tableau
How to view your website stats in tableauHow to view your website stats in tableau
How to view your website stats in tableau
 
WPF DATA BINDING CHEATSHEET V1.1
WPF DATA BINDING CHEATSHEET V1.1WPF DATA BINDING CHEATSHEET V1.1
WPF DATA BINDING CHEATSHEET V1.1
 
ETL Validator Usecase -Metadata Comparison
ETL Validator Usecase -Metadata ComparisonETL Validator Usecase -Metadata Comparison
ETL Validator Usecase -Metadata Comparison
 
Tools and connectors
Tools and connectorsTools and connectors
Tools and connectors
 

Similar to Cis266 final review

Similar to Cis266 final review (20)

Windows Mobile 5.0 Data Access And Storage Webcast
Windows Mobile 5.0 Data Access And Storage WebcastWindows Mobile 5.0 Data Access And Storage Webcast
Windows Mobile 5.0 Data Access And Storage Webcast
 
Mapping Data Flows Training deck Q1 CY22
Mapping Data Flows Training deck Q1 CY22Mapping Data Flows Training deck Q1 CY22
Mapping Data Flows Training deck Q1 CY22
 
Azure Data Factory Data Flows Training (Sept 2020 Update)
Azure Data Factory Data Flows Training (Sept 2020 Update)Azure Data Factory Data Flows Training (Sept 2020 Update)
Azure Data Factory Data Flows Training (Sept 2020 Update)
 
Mapping Data Flows Training April 2021
Mapping Data Flows Training April 2021Mapping Data Flows Training April 2021
Mapping Data Flows Training April 2021
 
Ado.net with asp.net
Ado.net with asp.netAdo.net with asp.net
Ado.net with asp.net
 
CIS 282 Final Review
CIS 282 Final ReviewCIS 282 Final Review
CIS 282 Final Review
 
Dev308
Dev308Dev308
Dev308
 
SSIS 2008 R2 data flow
SSIS 2008 R2 data flowSSIS 2008 R2 data flow
SSIS 2008 R2 data flow
 
SQL Server Stored procedures
SQL Server Stored proceduresSQL Server Stored procedures
SQL Server Stored procedures
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
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
 
QTP Automation Testing Tutorial 7
QTP Automation Testing Tutorial 7QTP Automation Testing Tutorial 7
QTP Automation Testing Tutorial 7
 
AWS RDS Migration Tool
AWS RDS Migration Tool AWS RDS Migration Tool
AWS RDS Migration Tool
 
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
Ado.netAdo.net
Ado.net
 
Ado Net
Ado NetAdo Net
Ado Net
 
ADO.Net Improvements in .Net 2.0
ADO.Net Improvements in .Net 2.0ADO.Net Improvements in .Net 2.0
ADO.Net Improvements in .Net 2.0
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
Ado.net
Ado.netAdo.net
Ado.net
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 

More from Randy Riness @ South Puget Sound Community College

More from Randy Riness @ South Puget Sound Community College (20)

Stored procedures
Stored proceduresStored procedures
Stored procedures
 
3 sql overview
3 sql overview3 sql overview
3 sql overview
 
Normalization
NormalizationNormalization
Normalization
 
CIS160 final review
CIS160 final reviewCIS160 final review
CIS160 final review
 
SQL Constraints
SQL ConstraintsSQL Constraints
SQL Constraints
 
CIS 245 Final Review
CIS 245 Final ReviewCIS 245 Final Review
CIS 245 Final Review
 
CIS145 Final Review
CIS145 Final ReviewCIS145 Final Review
CIS145 Final Review
 
Cis166 Final Review C#
Cis166 Final Review C#Cis166 Final Review C#
Cis166 Final Review C#
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 
CIS245 sql
CIS245 sqlCIS245 sql
CIS245 sql
 
Cis245 Midterm Review
Cis245 Midterm ReviewCis245 Midterm Review
Cis245 Midterm Review
 
CSS
CSSCSS
CSS
 
XPath
XPathXPath
XPath
 
XSLT Overview
XSLT OverviewXSLT Overview
XSLT Overview
 
Views
ViewsViews
Views
 
CIS282 Midterm review
CIS282 Midterm reviewCIS282 Midterm review
CIS282 Midterm review
 
Schemas 2 - Restricting Values
Schemas 2 - Restricting ValuesSchemas 2 - Restricting Values
Schemas 2 - Restricting Values
 
CIS 145 test 1 review
CIS 145 test 1 reviewCIS 145 test 1 review
CIS 145 test 1 review
 
XML schemas
XML schemasXML schemas
XML schemas
 
Document type definitions part 2
Document type definitions part 2Document type definitions part 2
Document type definitions part 2
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
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.
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
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
 
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_...
 
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)
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
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)
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 

Cis266 final review

  • 2. Use the DataSet object  To transfer data between tiers  To manipulate the data without an open connection  To relate data from multiple sources  To bind data to a Windows form
  • 3. Referring to Records, Fields  Actual data values are held in DataRow objects  Each Table object in a dataset has a DataRows collection made up of DataRow objects  Data values are held in the DataRow.Items collection  Refer to fields by index position or by name (string value)
  • 4. Setting a Relationship  A DataRelation object describes the relationship between the tables.  Use the XML schema (.xsd) file for the dataset to create the relationship – or – use code to create a relation  DataRelation Object Functions  Relating tables  Setting up constraints
  • 5. Retrieving Related Row(s)  Use the GetParentRow method to retrieve the matching row from the table on the one side  The GetChildRows method returns an array of rows from the many table  May have 0, 1, or more related records  Use Find method to find a row by its primary key value
  • 6. DataRowState Enumeration  Used for finding, accessing changed rows  The HasChanges Method determines if changes have been made to a dataset  Returns a boolean value  The GetChanges Method is used to retrieve datatable rows that have changes  Use an empty argument to retrieve all changed rows OR specify type of changes using enumeration values
  • 7. The Binding Source  Controls record position within a table  Assures that all bound controls on a form display data from the same record  Can bind controls in design time or in code
  • 8. Binding Source Properties  Position property holds the current row number (zero based)  Count property indicates the number of records in a table  The Current Property returns the current row
  • 9. Binding Source Methods  Binding Source Events  The CurrentChanged event occurs when a bound value is changed  The PositionChanged event occurs when a user navigates to another record
  • 10. Adding an Event Handler  An event handler executes automatically when an event occurs.  Need to write event handlers for objects declared in code  Write the procedure you want to execute when the event occurs, including the sender and eventargs arguments  Add the handler in another procedure (such as constructor), which is called a delegate  turns the general procedure written into an event procedure
  • 11. DataRow Versions  The DataRow object maintains several versions of its column data  Current, Original, Default, Proposed  If no changes have been made, the Current and Original versions are the same  When EndEdit executes, the Current version is replaced by the Proposed  The EndEdit method confirms the changes  Changes are made when the AcceptChanges method executes
  • 12. Changing Data  Changes are made to the dataset, not to the original data source.  Execute the data adapter’s Update method before calling the AcceptChanges method.
  • 13. The AcceptChanges Method  Calls the EndEdit method of the data row  Removes all rows marked for deletion  Makes the adds and edits indicated for the table  Sets the Original version of each changed row to the Current version  Sets RowState of each row to Unchanged  The RejectChanges replaces Current versions with the Original versions  After AcceptChanges or RejectChanges executes, all RowState properties are reset to Unchanged
  • 14. Data Adapter Update Method  Update writes the changes to the database using SQL action queries  Uses a group of Command Objects  One each for insert, update and delete  Can use actual queries or refer to stored procedures
  • 15. When to Update?  Every time an add, edit, delete occurs?  When the program terminates?  Provide a Save option on a menu and prompt for unsaved changes when the program terminates?
  • 16. Update Considerations  Where does the application and data reside?  How many users can make changes?  Does the data source need to be up-to-date at all times?
  • 17. Concurrency  Concurrency control is the process of handling conflicts in updates by multiple users.  Pessimistic concurrency control – a row is unavailable from the time the record is retrieved until the update is complete  Optimistic concurrency control – a row is unavailable only while an update is in progress (default)  “Last in wins” – A row is unavailable only when the update is being made.
  • 18. Parent/Child Relationships  To maintain referential integrity, update in the following order:  Delete any child records  Insert, update, and delete the parent records  Insert and update the child records
  • 19. Displaying Related Data  Use a DataRelation  Use GetChildRows/GetParentRow methods  Use a Binding Source that uses a Datarelation as its datasource  Filter rows by  Using a For loop and adding to an array or datable  Use table.Select method  Requery database for related records  Use Parameter Query; or  Use a variable and build a Select statement with where clause
  • 20. Stored Procedures  Can store compiled SQL statement in database  Helps reduce security threats  Can reduce data passed across network  Typically work directly with a command object  Need to set command type  Need to establish connection for command
  • 21. Parameters  Stored procedures accept and return values through parameters  Input parameters are similar to arguments in procedural languages  Command object has a parameters collection to specify parameters to use with stored procedure  Can use parameters to pass criteria or values to edit rows

Editor's Notes

  1. 06/10/10 CIS-266 Final Review
  2. 06/10/10 CIS-266 Final Review