March 5, 2021
Hot Topics:

Visual Basic Database Tutorial - Part 4

  • By Karl Moore
  • Send Email »
  • More Articles »

Previously, weve accessed databases solely through the Data control. But this time were doing it in code, using objects.

Just as you "Dim XYZ as String", were going to do the same with a collection of special objects that allow us to play with our database. For example, you might write "Dim XYZ as Recordset" - which is an object that holds a set of records - then later say "XYZ.Delete", to delete one particular record.

I remember back in the golden olden days of my programming life, when I first saw database access code. Argh! I mean, whod want to write all that code when you have the Data controls?

After a bit of use, it becomes clear that those Data controls arent particularly cool. After all, you often want just one little bit of information from the database - and then youre finished with it. Without code, youll have a clunky Data control constantly loitering on one of your forms. With code, you can simply tell Visual Basic, "access the database, get me that information, close the database"... the end.

In brief, accessing databases via code is amazingly flexible. Oh, and its something else to brag about at the next Visual Basic group meeting.

Page 3 of 8

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date