Chapter 18 Getting Started with ADO .NET 457
The record is deleted from the dataset, and the position indicator shows that there
are now 19 records remaining. (Lan has become the last and current record .) Your form
looks like this:
As I mentioned earlier, the dataset represents only the subset of tables from
the Faculty2010 database that have been used in this project—the dataset is
a disconnected image of the database, not the database itself. Accordingly, the record
that you deleted has been deleted only from the dataset that is loaded in memory
while the program is running. However, to verify that the program is actually working
with disconnected data and is not modifying the original database, you’ll stop
and restart the program now.
- Click the Close button on the form to end the program.
The program terminates, and the IDE returns.
- Click Start Debugging to run the program again.
When the program restarts and the form loads, the navigation toolbar shows that the
dataset contains 20 records, as it did originally. In other words, it works as expected.
- Click the Move Last button to view the last record in the dataset.
The record for Skinner appears again. This final faculty name was deleted only from
memory and has reappeared because the underlying database still contains the name.
- Click the Close button again to close the program.
Congratulations! Without writing any program code, you have built a functioning database
application that displays specific information from a database. Setting up a dataset has taken
many steps, but the dataset is now ready to be used in many useful ways in the program.
Although I selected only one table and two fields from the Faculty2010 database to reduce
screen clutter and focus our attention, you will probably want to select a much wider range