• At this point, we know how to use the data control and associated data
bound tools to access a
database. The power of Visual Basic lies in its ability
to manipulate records in code. Such tasks as determining the values of particular
fields, adding records, deleting records, and moving from record to record are
easily done. This allows us to build a complete
database management system (
DBMS).
• We don’t want to change the example database, BIBLIO.MDB. Let’s
create our own database to change. Fortunately, Visual Basic helps us out here.
The Visual Data Manager is a Visual Basic Add-In that allows the creation and
management of databases. It is simple to use and can create a database compatible
with the Microsoft Jet (or Access) database engine.
• To examine an existing database using the Data Manager, follow these
steps:
-
Select Visual Data Manager from Visual Basic’s Add-In menu (you may be
asked if you want to add SYSTEM.MDA to the .INI file - answer No.)
-
Select Open Database from the Data Manager File menu.
-
Select the database type and name you want to examine.
Once the database is opened, you can do many things. You can simply look through
the various tables. You can search for particular records. You can apply SQL queries.
You can add/delete records. The Data Manager is a DBMS
in itself. You might try using the Data Manager to look through the BIBLIO.MDB
example database.
• To create a new database, follow these steps:
-
Select Visual Data Manager from Visual Basic’s Add-In
menu (you may be asked if you want to add SYSTEM.MDA to the .INI file - answer
No.)
-
Select New from the Data Manager File menu.
Choose database type (Microsoft Access, Version 7.0), then select a directory
and enter a name for your database file. Click OK.
-
The Database window will open. Right click the window and select New
Table. In the Name box, enter the name of your table.
Then define the table’s fields, one at a time, by clicking Add Field,
then entering a field name, selecting a data type, and specifying the size of
the field, if required. Once the field is defined, click the OK button
to add it to the field box. Once all fields are defined, click the Build
the Table button to save your table.