CIS266FINAL REVIEW
Use the DataSet object To transfer data between tiers To manipulate the data without an open  connection To relate data...
Referring to Records, Fields Actual data values are held in DataRow  objects   Each Table object in a dataset has a Data...
Setting a Relationship A DataRelation object describes the  relationship between the tables. Use the XML schema (.xsd) f...
Retrieving Related Row(s) Use the GetParentRow method to retrieve  the matching row from the table on the one  side The ...
DataRowState Enumeration Used for finding, accessing changed rows The HasChanges Method determines if  changes have been...
The Binding Source Controls record position within a table Assures that all bound controls on a form  display data from ...
Binding Source Properties Position property holds the current row  number (zero based) Count property indicates the numb...
Binding Source Methods Binding Source Events The CurrentChanged event occurs when a  bound value is changed The Positio...
Adding an Event Handler An event handler executes automatically  when an event occurs. Need to write event handlers for ...
DataRow Versions The DataRow object maintains several versions  of its column data   Current, Original, Default, Propose...
Changing Data Changes are made to the dataset, not to the  original data source. Execute the data adapter’s Update metho...
The AcceptChanges Method Calls the EndEdit method of the data row Removes all rows marked for deletion Makes the adds a...
Data Adapter Update Method Update writes the changes to the database  using SQL action queries Uses a group of Command O...
When to Update? Every time an add, edit, delete occurs? When the program terminates? Provide a Save option on a menu an...
Update Considerations Where does the application and data reside? How many users can make changes? Does the data source...
Concurrency Concurrency control is the process of handling  conflicts in updates by multiple users. Pessimistic concurre...
Parent/Child Relationships To maintain referential integrity, update in  the following order: Delete any child records ...
Displaying Related Data Use a DataRelation   Use GetChildRows/GetParentRow methods   Use a Binding Source that uses a D...
Stored Procedures Can store compiled SQL statement in  database   Helps reduce security threats   Can reduce data passe...
Parameters Stored procedures accept and return values  through parameters   Input parameters are similar to arguments in...
Upcoming SlideShare
Loading in …5
×

Cis266 final review

453 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
453
On SlideShare
0
From Embeds
0
Number of Embeds
55
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 06/10/10 CIS-266 Final Review
  • 06/10/10 CIS-266 Final Review
  • Cis266 final review

    1. 1. CIS266FINAL REVIEW
    2. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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

    ×