Application Development with Harbour/Database Connectivity

How to Create and Fill a DBF File
Step 1: Create a file DbTests.prg

Step 2: Write the following code in that file DbTests.prg:

Step 3: Compile and run DbTests.prg

This code in Clipper displays a message on the screen and creates a new database structure file named testdbstructure - you should see that a testdbstructure.dbf is created in the same directory as DbTests.prg, this DBF file is a where columns names of other dbffiles are described in rows

The columns of this testdbstructure are FIELD_NAME, FIELD_TYPE, FIELD_LEN, FIELD_DEC.

Step 4: Create 3 rows which has a FIELD_NAME, FIELD_TYPE, FIELD_LEN, FIELD_DEC and then close the current dbf file

The code uses the APPEND BLANK command to add three new blank records to the table.

The code then uses the "->" operator to access the fields in the table and define the field values. For example, the command "FIELD->FIELD_NAME := "ContactId"" sets the value of the "FIELD_NAME" field in the first record to "ContactId". The other two commands define the values ​​of the "Name" and "Email" fields in the remaining records.

Finally, the "Main" procedure ends with the "CLOSE" command, which closes the table, and the "RETURN" command, which returns control to the main program or procedure that called it.

Tip: to view the contents of a DBF file you can use GNumeric (http://www.gnumeric.org/) or LibreOffice Calc (http://www.libreoffice.org/) - most spreadsheet programs support DBF files.

Step 5: Create a dbf file with the name contacts.dbf from the testdbstructure.dbf. The columns of contacs.dbf are now the FIELD_NAME rows of testdbstructure.dbf. And then put in some testdata in Contacts.dbf

Use LibreOffice Calc to open and see the content of the file Contacts.dbf.

RDDs and Database Connectivity
https://harbourlanguage.blogspot.com/2010/06/understanding-harbour-rdd.html