FoxPro / FoxBase Database Driver

Top  Previous  Next

Database Drivers

Choosing the Right Database Driver

Common Database Driver Features

Driver Strings



FoxPro:Data Types

FoxPro:Supported Commands and Attributes

FoxPro:Driver Strings



The FoxPro file driver is compatible with FoxPro and FoxBase. The default data file extension is *.DBF.

The default index file extension is *.IDX. The default Memo file extension is .FBT. FoxPro also supports multiple index files, whose default extension is *.CDX. The miscellaneous section describes the procedures for using the .CDX files.



Windows Static Link Library



Windows Export Library



Windows Dynamic Link Library


The FoxPro index file format is the backbone of its vaunted "Rushmore" technology. The old saying "There's no free lunch," however, applies. Adding and appending records to a large database is a slower process than in other xBase formats, due to the time required to update the index file.

FoxPro:Data Types

The xBase file format stores all data as ASCII strings. You may either specify STRING types with declared pictures for each field, or specify native Clarion types, which the driver converts automatically.

FoxPro data type

Clarion data type

STRING w/ picture
















If your application reads and writes to existing files, a pictured STRING will suffice. However, if your application creates a FoxPro or FoxBase file, you may require additional information for these FoxPro and FoxBase types:

*      To create a numeric field in the Data Dictionary, choose the REAL data type. In the External Name field on the Attributes tab, specify 'NumericFieldName=N(Precision,DecimalPlaces)' where NumericFieldName is the name of the field, Precision is the precision of the field and DecimalPlaces is the number of decimal places. With a REAL data type, you cannot access the Character or Places fields in the Field definition, you must specify those attributes with an expression in the External Name Field on the Attributes tab.

For example, if you want to create a field called Number with nine significant digits and two decimal places, enter 'Number=N(9,2) in the External Name field on the Attributes tab of the Field properties in the Data Dictionary.

If you're hand coding a native Clarion data type, add the NAME attribute using the same syntax.

If you're hand coding a STRING with picture, STRING(@N-_9.2), NAME('Number'), where Number is the field name.

*      To create a logical field, using the data dictionary, choose the BYTE data type. There are no special steps; however, see the miscellaneous section for tips on reading the data from the field.

If you're hand coding a STRING with picture, add the NAME attribute: STRING(1), NAME('LogFld = L').

*      To create a date field, using the data dictionary, choose the DATE data type, rather than LONG, which you usually use for the TopSpeed or Clarion file formats.

*      MEMO field declarations require the a pointer field in the file's record structure. Declare the pointer field as a STRING(10) or a LONG. This field will be stored in the .DBF file containing the offset of the memo in the .DBT file. The MEMO declaration must have a NAME() attribute naming the pointer field. An example file declaration follows:

File  FILE, DRIVER('FoxPro')

Memo1  MEMO(200),NAME('Notes')

Memo2  MEMO(200),NAME('Text')


Mem1Ptr LONG,NAME('Notes')

Mem2Ptr STRING(10),NAME('Text')



FoxPro:File Specifications/Maximums


File Size:             2,000,000,000 bytes

Records per File:      1,000,000,000 bytes

Record Size:           4,000 bytes

Field Size

 Character:           254 bytes

 Date:                8 bytes

 Logical:             1 byte

 Numeric:             20 bytes including decimal point

 Float:               20 bytes including decimal point

 Memo:                65,520 bytes (see note)

Fields per Record:     512

Field Name:            10 characters

Keys/Indexes per File: No Limit

Key Sizes

 Character:           100 bytes (.IDX)

                      254 bytes (.CDX)

 Numeric, Date:       8 bytes

Memo fields per File:  Dependent on available memory

Open Files:            Operating system dependent