Working with databases (OleDb, MS Access 2007) code-wise (SELECT COMMAND)

When learning how to work with databases in college / highschool they often teach people how to do it with the wizard from Visual Studio x

I always found that this method doesn’t give me the desired amount of control i’d like to have over my application, so i’ve always done it code wise.
Yes, it’s a bit of extra work, but it’s worth it.

If you plan on doing this, there will always be a set of objects you’ll need in order to work with a database:

  1. A database connection
  2. A SQL command
  3. For reading data (SELECT) a DataReader

I’m not going to handle working with datasets & gridviews in this post, you can view a small example of that here: Fill a DataGridView from a DataSet (code-wise)

We’ll start off by defining the objects we need:

Continue reading Working with databases (OleDb, MS Access 2007) code-wise (SELECT COMMAND)