Programming Lab 6: Employee Data Program (Data-Bound in code), due Thursday, 11/9
Objective: To write a program using data-bound controls to manipulate a table, without data controls
from the Toolbox
Here are the details and rules:
- Write a program to allow the user to view, enter and save Employee data like shown here:
- This program is a lot like Practice Problem 3, except now I want you to write the code to setup the
Connection, DataSet, and DataAdapter yourself.
- Look back at the book, notes, and examples from Chapter 1 for example code to help you with this
assignment.
- Don't drag and drop anything from the Server Explorer onto your form, and don't use any controls
from the Data tab of the Toolbox.
- To setup the update commands for your DataAdapter, use a CommandBuilder.
- The Employee ID should be treated by your program as a read-only auto-number field, automatically
generating and displaying a new ID when the user clicks "Add"
- To save changes in the current record as well as previously changed records, call the
CurrencyManager's EndCurrentEdit() method before calling the DataAdapter's Update() method.
- When turning in your homework, turn in a zip file containing your entire solution.
- For 5% Extra Credit handle the following issues/exceptions (if possible):
- Your program should catch the exception that occurs when an invalid Department ID is entered,
giving the user the opportunity to re-enter a correct value.
- A concurrency violation would occur if another user modifies the record you want to modify before
you do it. To test for such a violation, you can run two instances of your application and have them
both change the same record after they both loaded the original value, or you can make a change to the
data in the database while your application is running, then try to change that record from your
application.
- To respond to a concurrency violation, re-load the data and display the disputed record in its
changed format, with a message box explaining why the change wasn't saved.
Return to main CS 112D page