4. Form Contents dataset manages data in memory table adapter manages the requests for data (both in/out of db) Can include multiple SELECT statements table adapter manager controls how to manage data changes to table and related tables In relational database order of edits matters
5. Form Contents - 2 data grid view provides on screen display of data Includes built in tools – sorting, adjusting table binding navigator manages navigation of rows/editing binding source connects form/controls to data set Serves as “glue” to make sure the contents of each field in each row properly displayed in controls
6. Binding Complex data binding happens when dealing with rows and columns (grid, list controls) Simple data binding is for a control connected to a single column
7. Reading/Writing Data Getting data: Table adapter (or data adapter) has a FILL method that executes the SELECT statement An argument specifies where the data should end up in memory Saving data: Table adapter (or data adapter) has an UPDATE method Table adapter manager has an UPDATE ALL that manages the execution of updates to related tables
8. Reading/Writing Data - 2 Ensure that all validation is done (Me.Validate) Ensure that no editing is going on before use Update (bindingsource.EndEdit) Referential integrity means order matters
9. Exceptions Have exception classes for each data provider (SQL Server, Oracle, OLEDB, ODBC) Reading the Number property of SQL Server exception objects refers to the specific error from SQL Server Typical exceptions in ADO.Net not provider based DB Concurrency - row in table is different that the original version (optimistic concurrency) Data Exception - generic exception from provider Constraint Exception violates validation rules No null allowed - required field is missing a value
10. Data Grid Exceptions Data grid can generate exceptions Value in cell doesn't match requirements in data column (Null, invalid type) Can find the location of an exception by Row and Column (index values)
11. Refreshing Data After save data, may want to "refresh" the dataset - make sure what's in memory is same as what was saved, especially when have identity columns