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

VISUAL BASIC .net data accesss vii
VISUAL BASIC .net data accesss viiVISUAL BASIC .net data accesss vii
VISUAL BASIC .net data accesss viiargusacademy
 
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 VarianceDatagaps Inc
 
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 tableaunModal Solutions Inc.
 
asp.net data controls
asp.net data controlsasp.net data controls
asp.net data controlssubakrish
 
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 WPFQuang Nguyễn Bá
 
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 ComparisonDatagaps Inc
 
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 WPFQuang Nguyễn Bá
 
Stat2 25 09
Stat2 25 09Stat2 25 09
Stat2 25 09stat
 
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 conformanceDatagaps Inc
 
SAP BO Web Intelligence Basics
SAP BO Web Intelligence BasicsSAP BO Web Intelligence Basics
SAP BO Web Intelligence BasicsKiran Joy
 
BI-Validator Usecase - Stress Test Plan
BI-Validator Usecase - Stress Test PlanBI-Validator Usecase - Stress Test Plan
BI-Validator Usecase - Stress Test PlanDatagaps Inc
 
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 sourceDatagaps Inc
 
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 tableauBen Jones
 
WPF DATA BINDING CHEATSHEET V1.1
WPF DATA BINDING CHEATSHEET V1.1WPF DATA BINDING CHEATSHEET V1.1
WPF DATA BINDING CHEATSHEET V1.1Vikas Pandey
 
ETL Validator Usecase -Metadata Comparison
ETL Validator Usecase -Metadata ComparisonETL Validator Usecase -Metadata Comparison
ETL Validator Usecase -Metadata ComparisonVasavi Chinta
 

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

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 

Recently uploaded (20)

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 

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