skip to content »

C updating 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.

c updating database-86c updating database-15

Since we now have a database connection made, we have a few choices on how to query and load our data. Some have their advantages and disadvantages, so be sure to research which one might fit your needs the most.” So I figured I would put a few little snippets here to show you some ways it can be done.We will work on reading a simple column (name) from an Access Database table (Employees) and stick those names into a listbox for selection.NET has to dedicate less resources to managing the internal record pointer and can speed up access.This means it is great for any situation where you simply want to loop through the values quickly and easily without needing to go back. Of course this is also the disadvantage, we can’t simply go to the previous record if we wanted to.The first example will be to use a Data Adapter class and its fill method to load it into a Data Set.

Think of this method like using a hose to fill up a bucket.

We could reset the pointer, but then that would kill the speed here.

// Our command object which again uses the connection string and a connection object Ole Db Command cmd = new Ole Db Command("select name from employees", connection); // Our reader is going to fetch our results Ole Db Data Reader reader = cmd.

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.

The second method I will show you is again using a dataset but this time we will loop through it to load the listbox.