This sample builds upon our Checkbox Sample
by showing you how to save checkbox data to a database.
Since a checkbox only has two possible states (checked or unchecked)
it makes the most sense to store it in your database as a boolean
value. Now whether checked means True or False is up to you and
what your data actually means, but for the purposes of this sample, we'll
assume that a checked checkbox corresponds to a database
value of True.
This sample isn't really about the database connectivity side of things.
For more information about setting up a connection string or building a
SQL query, you'll want to take a look at some of our database samples.
To keep things simple, I don't actually connect to a database in this code.
Instead, I create and update an in-memory recordset. The code which
connects the recordset to the form and updates the data in the recordset
is the same as it would be if it was connected to an Access or SQL Server
database. The benefit of doing it this way is that
you can download and play with the code without having to go through all
the trouble of downloading and setting up an accompanying database.