Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Working with designers


Published on

  • Be the first to comment

  • Be the first to like this

Working with designers

  1. 1. Working With Designers<br />CIS-266<br />
  2. 2. Connection String<br />Stored in app.config (XML file)<br /><ul><li>Connection string with a local database specifies a |DATA| directory
  3. 3. Database file is copied from project folder to bin folder when run project</li></li></ul><li>Schema File<br />XSD file uses XML to define dataset contents<br />
  4. 4. Form Contents<br />dataset manages data in memory<br />table adapter manages the requests for data (both in/out of db)<br />Can include multiple SELECT statements<br />table adapter manager controls how to manage data changes to table and related tables<br />In relational database order of edits matters<br />
  5. 5. Form Contents - 2<br />data grid view provides on screen display of data <br />Includes built in tools – sorting, adjusting table<br />binding navigator manages navigation of rows/editing<br />binding source connects form/controls to data set<br />Serves as “glue” to make sure the contents of each field in each row properly displayed in controls<br />
  6. 6. Binding<br />Complex data binding happens when dealing with rows and columns (grid, list controls)<br />Simple data binding is for a control connected to a single column<br />
  7. 7. Reading/Writing Data<br />Getting data: Table adapter (or data adapter) has a FILL method that executes the SELECT statement<br />An argument specifies where the data should end up in memory<br />Saving data: <br />Table adapter (or data adapter) has an UPDATE method<br />Table adapter manager has an UPDATE ALL that manages the execution of updates to related tables <br />
  8. 8. Reading/Writing Data - 2<br />Ensure that all validation is done (Me.Validate) <br />Ensure that no editing is going on before use Update (bindingsource.EndEdit)<br />Referential integrity means order matters<br />
  9. 9. Exceptions<br />Have exception classes for each data provider (SQL Server, Oracle, OLEDB, ODBC)<br />Reading the Number property of SQL Server exception objects refers to the specific error from SQL Server<br />Typical exceptions in ADO.Net<br />not provider based<br />DB Concurrency - row in table is different that the original version (optimistic concurrency)<br />Data Exception - generic exception from provider<br />Constraint Exception violates validation rules<br />No null allowed - required field is missing a value<br />
  10. 10. Data Grid Exceptions<br />Data grid can generate exceptions<br />Value in cell doesn't match requirements in data column (Null, invalid type)<br />Can find the location of an exception by Row and Column (index values)<br />
  11. 11. Refreshing Data<br />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<br />