Visual Basic Database Tutorial - Part 1
That's all fine and dandy, but how do you actually create a database?
Unfortunately, just to confuse us all, there are many different types of databases. First off, there's an expensive whopper of a database system called SQL Server, which is used in corporations that need to store huge wads of information. Theres also that thing they call Oracle, which is another database format.
But one of the most exciting (and cheap!) types of database is an Access database. Remember when we changed the DatabaseName property of our data control to "Nwind.mdb"?
That Nwind.mdb file is actually an Access database.
The best way to create your own Access database is by using, unsurprisingly, Microsoft Access. This tool ships with the professional editions of Office 97 and enables you to graphically design your own tables and individual fields.
If you dont already have Microsoft Access, add it to your Christmas list and be a good boy. If you do have it, brilliant!
We'll delve into the intricacies of creating your own database next week but for now let's explore the existing Nwind.mdb database:
1. Click on Start, Programs, Microsoft Access
2. Select "More Files" then click OK
3. At the Open dialog box, select the Nwind.mdb file dont forget, by default it is installed at C:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb
4. Click OK when the boring "Welcome to Northwind" screen appears
5. A box should appear on your screen, looking a little like this:
6. Click on the tab entitled "Tables". These are all the tables in your database including the Customers one we browsed earlier in this tutorial
7. Double-click on the Customers table. You should see something like this:
That's a table! The names at the very top of the screen are field names. Under that, youll find all the actual information. Each singular row of information is known as a record. If you move right down to the bottom of the table, you can also add new customers to the Customers table.
Try it now!
1. Click on the "Add New" button on the frame around the customer data
2. Fill in all the boxes for the new record, inventing wacky company names and telephone numbers as you go along
3. Now close the table and re-open it
4. Scour down the list and you should now see your customer listed alphabetically
5. Click on any field in your record, then click Edit, Delete Record6. You should be asked if you want to delete the selected record. Click Yes and it should disappear!
Well done you've just looked behind the scenes of a real database, added a record and then manually removed it!
Page 4 of 5