VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering

Browse Topics

- Getting started
- Data Types
- Modules
- Operators in VB6
- VB6 Variable
- VB6 Procedures
- VB6 Control Structures
- Loops in VB6
- VB6 Exit Do & With End With
- Arrays in VB6
- User-Defined Data Types
- VB6 Constants
VB6 Built-in Functions
- Date and Time in VB6
- VB6 Controls
- TextBox Control
- ComboBox & OptionButton
- Label & Frame
- PictureBox & ImageBox
- Timer Control
- ListBox & ComboBox
- VB6 ScrollBar
- Control Arrays in VB6
- Files controls in VB6
- VB6 CheckBox
- Forms in VB6
- Menus in VB6
- MDI Form in VB6
- InputBox
- MessageBox
- Mouse events
- Mouse Move
- Error Handling
Error Handling (2)
VB6 Database

You are here: Visual Basic > VB6 (Beginners Tutorial)

Tutorial Main Page | Previous Page | Contents | Next Page

Database Structure and Terminology

• In simplest terms, a database is a collection of information. This collection is stored in well-defined tables, or matrices.

• The rows in a database table are used to describe similar items. The rows are referred to as database records. In general, no two rows in a database table will be alike.

• The columns in a database table provide characteristics of the records. These characteristics are called database fields. Each field contains one specific piece of information. In defining a database field, you specify the data type, assign a length, and describe other attributes.

• Here is a simple database example:

In this database table, each record represents a single individual. The fields (descriptors of the individuals) include an identification number (ID No), Name, Date of Birth, Height, and Weight.

• Most databases use indexes to allow faster access to the information in the database. Indexes are sorted lists that point to a particular row in a table. In the example just seen, the ID No field could be used as an index.

• A database using a single table is called a flat database. Most databases are made up of many tables. When using multiple tables within a database, these tables must have some common fields to allow cross-referencing of the tables. The referral of one table to another via a common field is called a relation. Such groupings of tables are called relational databases.

• In our first example, we will use a sample database that comes with Visual Basic. This database (BIBLIO.MDB) is found in the main Visual Basic directory (try c:\Program Files\Microsoft Visual Studio\VB98). It is a database of books about computers. Let’s look at its relational structure. The BIBLIO.MDB database is made up of four tables:

Authors Table (6246 Records, 3 Fields)

The Authors table consists of author identification numbers, the author’s name, and the year born. The Publishers table has information regarding book publishers. Some of the fields include an identification number, the publisher name, and pertinent phone numbers. The Title Author table correlates a book’s ISBN (a universal number assigned to books) with an author’s identification number. And, the Titles table has several fields describing each individual book, including title, ISBN, and publisher identification

Note each table has two types of information: source data and relational data. Source data is actual information, such as titles and author names. Relational data are references to data in other tables, such as Au_ID and PubID. In the Authors, Publishers and Title Author tables, the first column is used as the table index. In the Titles table, the ISBN value is the index.

• Using the relational data in the four tables, we should be able to obtain a complete description of any book title in the database. Let’s look at one example:

Here, the book in the Titles table, entitled “Step-by-step dBase IV,” has an ISBN of 0-0280095-2-5 and a PubID of 52. Taking the PubID into the Publishers table, determines the book is published by McGraw-Hill and also allows us to access all other information concerning the publisher. Using the ISBN in the Title Author table provides us with the author identification (Au_ID) of 171, which, when used in the Authors table, tells us the book’s author is Toby Wraye.

• We can form alternate tables from a database’s inherent tables. Such virtual tables, or logical views, are made using queries of the database. A query is simply a request for information from the database tables. As an example with the BIBLIO.MDB database, using pre-defined query languages, we could ‘ask’ the database to form a table of all authors and books published after 1992, or provide all author names starting with B. We’ll look briefly at queries.

• Keeping track of all the information in a database is handled by a database management system (DBMS). They are used to create and maintain databases. Examples of commercial DBMS programs are Microsoft Access, Microsoft FoxPro, Borland Paradox, Borland dBase, and Claris FileMaker. We can also use Visual Basic to develop a DBMS. Visual Basic shares the same ‘engine’ used by Microsoft Access, known as the Jet engine. In this class, we will see how to use Visual Basic to access data, display data, and perform some elementary management operations.


Tutorial Main Page | Previous Page | Contents | Next Page


Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved