Creating a Database File
Before Creating Database in fox pro we should understand
Data type. Various type of data type used according to requirement-
Data type
|
Size (bytes)
|
Description
|
Range
|
Character
|
1 to 254
|
Any Characters and text abb- C
|
ex- a-z, ?, # etc
|
Numeric
|
1 to 20
|
Integer and fraction , abb.-N
|
- .9999999999E+19 to .9999999999E+20
|
Currency
|
8 bytes
|
Amounts, abb.- Y
|
- 922337203685477.5807 to 922337203685477.5807
|
Date
|
8 bytes
|
Date entry, Abb.- D
|
|
Datetime
|
8 bytes
|
Date with time, Abb.- T
|
Time in 00:00:00 to 11:59:59
|
Logical
|
1 bytes
|
Logical entry, Abb.-L
|
Only .T. and .F.
|
Double
|
8 bytes
|
More accurate with fraction, abb.-B
|
- .9999999999E+19 to .9999999999E+20
|
Integer
|
4 bytes
|
Space saver data type for numeric, abb.- I
|
-2,147,483,647 to 2,147,483,647
|
Float
|
1-20
|
Same as numeric, abb-F
|
- .9999999999E+19 to .9999999999E+20
|
Memo
|
4 bytes
|
Used to store more information in foxpro it is not saved in dbf file.
It is saved seperatly in FPT file, abb.-My name
|
Any text, symbol
|
General
|
4 bytes
|
Closely same as memo and its content is housed iin FPT file, abb- G
|
Any OLE document
|
Principal file types related to database-
1.
DBF-( Database file)
it is primary extension of foxpro. It is main storage file of database.
2.
DBC- (Database
container) Contains information aobut data file indexes, relationaships and
other aspects of a database. It is sometime called database dictionary.
3.
DCT- (Database
Container Text) stores the code and other text material for DBC file this is
not directly readable by FoxPro.
4.
FPT- (FoxPro Text)
it can store large quantities of text, picture.
Here general data of general field and memo fields are stored.
5.
CDX-(CompounD indeX)
Contain the indexes or DBF file.
6.
BAK- (BAcK up file)
it is created for DBF file.
7.
PRG- (PRoGram file)
it contain the source code of program
8.
SCX-(Screen File) it
store the form.
9.
FRX-(Report file) it
store the report.
Creating
Database
Ø There are two method to create database in
foxpro-
1.
Type CREATE in command window. in open box type file name -- ok
2.
File menu—New-
-A box will open here select Table/DBF
radio button
-ok
·
In
both case a box will open –
·
Here
define the structure according to requirement- Such as field name data type
it’s range
Field Name
|
Data type
|
Width
|
Name
|
Character
|
20
|
Location
|
Character
|
15
|
Address
|
Character
|
15
|
PIN
|
Character
|
8
|
Mob
|
Character
|
10
|
·
Ok
·
A
box will appear that say input record or not choose yes
·
A
window will appear hear each field name will show in separate row
·
Fill
the record one by one
·
When
finish press Esc button
Name
|
Location
|
Address
|
PIN
|
Mob
|
Tony
|
Station road
|
Barh
|
803213
|
98765778
|
Pyush
|
Bedhna
|
Barh
|
803213
|
99766666
|
Swati
|
Station road
|
Barh
|
876655
|
99877666
|
Kundan
|
GulabBagh
|
Mokama
|
876555
|
08877666
|
Nitish
|
Fathuha
|
Patna
|
876555
|
98766666
|
Note :
1.
don’t
use Numeric type data when not necessary, such as In PIN we can use Number data type but it
require more space in memory hence character is used.
2.
When
we use file menu – new then file will created with untitled.dbf
extension
Command:
1. CREATE: it provide facility to define structure of Database file.
Syntax: CREATE <Path with file name>
Ex:
CREATE address.dbf (create database file address in
current directory)
CREATE d:\address.dbf (create database
file in d: drive)
CREATE d:\my\address.dbf (create database file in directory of
drive d:)
Subscribe to:
Post Comments
(
Atom
)
need to learn full Foxpro .. post full tutorial ...
ReplyDeleteJust Wait I will Post Soon ...
ReplyDelete