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

Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
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...pradhanghanshyam7136
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
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 17Celine George
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
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.pptxDenish Jangid
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
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...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.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
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
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
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

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