Building data entry forms has always been pretty simple in Access VBA
and even Classic VB. This process is more complicated in C#, and really any
of the .NET languages. When using DAO and ADO, the main data object is the
recordset, which is connected to the
database, and you can easily move through records and perform all of the
CRUD operations (create, read, update, and delete). You can certainly do all
of those things in C#, but the data objects that you will be working with
are disconnected, which means that you will need to take explicit steps to
keep the datasource in sync with the changes.
There are controls in Visual Studio that can help you build a data entry form and navigate through the records. Those controls won’t be covered until the next chapter. While it is less likely that you’ll need to make a data entry form that dynamically adjusts to different datasources, it is still useful to build the data connections with code, even if it is just to help you understand what is happening behind the scenes when you use the controls.
The first thing that will be covered is a simple change to the project that we covered in Chapter 2. What you’ll be doing is adding a couple buttons to the form to allow you to browse through the records. Also, you will be adding a text box that will bind to a field in the table, and you will be able to make edits to the table in the grid or in the text box. This is an unlikely scenario in the real world, but it ...