Updating access database
While there are many ways to do these things, I simply create 3 different ways that you can play with below.At the end we will cover a quick way to make a nice update to the database.Just like you can give each option item in HTML select boxes a different value than its actual list item name.The advantage of this method is that it is a quick “dump all the info here” method.One great place to find connection string data for tons of different databases is at I am using a local instance of an access database that doesn’t require any real credentials to access. Ole Db namespace so we get to use Ole Db Connection as well as other classes you will see later.Another beautiful thing about using a Reader to move through data is because they are “forward only”.
This example will use the Data Set to “bind” to the listbox and empty its contents into the listbox control. The only trick here is that we bind the database to the listbox and tell the listbox to use the name column as both the names we display to the user as well as the value each item has.
It is also good in that it is directly tied to the dataset itself.
So if we modify the dataset, the listbox automatically changes as well.
Slightly different than the first method, differing only by how we load the data.
We could alter the tables in the Data Set directly before looping through it, but sometimes beginners find it easier to just loop through it like this and before displaying.
Nothing much to see here other than how to create the class and use a connection string to tell the connection where to find the database.