home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
QBAS
/
VBENGINE.ZIP
/
MAKEDB.FRM
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1993-04-04
|
4KB
|
86 lines
Form1
(Customer Database Table Creation Example
Form1
Label1
This example program shows how to create a Paradox database table using the VBENGINE. Examine the source code to see how its done.
Command1
Create Table
Command2
Create Index
Form_Click
Command1_Click
Customer
NewTable
TableNameh
NFields
FieldNames^
FieldTypes
status
OpenEngine
CreateTable
CloseEngine0
Command2_Click
customers
exact
AddKey
PRIMARY
Command1_Click
We will declare a variable of type NewTable to create ourr
database table
Used to detect errors.
Our database will consist of 6 fields and have
the following structure:
Field
Type
Name
A50
Address
A50
City
A30
State
Zip
Phone
Lets fill in the details of the tables structure heree
C:\Customer"
Specify the database file name
Six fields:Name,Address,City,State,Zip, and Phoned
Name,Address,City,State,Zip,Phone"
A50,A50,A30,A2,A10,A14
Ok, lets go ahead and create the database table usingg
VBENGINE function callss
Customer Creation Example"
Initialize database engine
If an error terminate the programr
Database Engine environment could not be initialized!"
Create the database tablee
If an error terminate the program
Customer database could not be created!"
Customer database was successfully created!"
Tell the user everything is A OK!
Now shut-down the database engine environmentd
If an error terminate the programi
Database engine could not be shut-down!"
Command2_Click
Here we create a PRIMARY index for the Customer tablee
on the Name field. This will be our only key field
in the Primary index..
no two customers will be able to have the exact same namee
and the table will be sorted alphabeticallyy
for error handling
Customer Creation Example"
Initialize database engine
If an error terminate the programt
Database Engine environment could not be initialized!"
We will use the AddKey function to create the indexx
The table name is "C:\CUSTOMER"
We want only one key field..
It is Name, the first field in the table..
C:\CUSTOMER"
If index creation failed
Failed to create Customer index!
Customer index successfully created!
Now shut-down the database engine environment"
If an error terminate the programi
Database engine could not be shut-down!"