Página 1 de 1

How to change dbf Structure

Publicado: Jue Jun 30, 2011 7:01 am
por chiragsoni
Hello,
Is there any method or function To Change DBF Stucture, Add/Modify Data Field.

How to change dbf Structure

Publicado: Mié Jul 06, 2011 5:41 am
por Carlos Ortiz
DbStruct()
Loads structural information of a database into an array.
Syntax
DbStruct() --> aStructure
Return
DbStruct() returns a two-dimensional array of four columns, filled with
structural information of a database.
Description
The DbStruct() function returns a two-dimensional array with FCount()
elements. Each element, again, contains a sub-array with four elements
holding information about each field of the database open in the current
work area. The elements in the sub-arrays can be accessed using #define
constants found in the DBSTRUCT.CH file.
Constants for the DbStruct() array Constant Value Meaning
DBS_NAME 1 Field name
DBS_TYPE 2 Field type
DBS_LEN 3 Field length
DBS_DEC 4 Field decimals
Example
// The example is the code for a useful command line utility
// that lists the database structure in a shell window.
#include "DbStruct.ch"
PROCEDURE Main( cDbfFile )
LOCAL aStruct
IF Empty( cDbfFile ) .OR. .NOT. File( cDbfFile )
CLS
? "Usage: dbstruct.exe <dbf file>"
QUIT
ENDIF
USE (cDbfFile)
aStruct := DbStruct()
AEval( aStruct, {|a| QOut( PadR( a[DBS_NAME], 10 ), ;
a[DBS_TYPE] , ;
Str( a[DBS_LEN ], 3 ), ;
Str( a[DBS_DEC ], 3 ) ;
) } )
USE
RETURN

How to change dbf Structure

Publicado: Lun Ago 15, 2011 4:35 pm
por chiragsoni
Thank You,
But I Want To Modify Structure without deleting existing dbf file. There are so many records. Now i want to Add a New Field.
Please Help...