BB>>Hello ALL!
Hi Bong,
BB>>How do I write a program that adds fields to an existing .DBF
BB>>without using DBU.EXE
BB>>First the program will detect the NAME.DBF if the new fields are
BB>>present. If not the new fields will be added.
I'm sure that they are better solution that what I found but I post you
something to try. I hope that it will help you !
//-------------------------------------------------------------------------
procedure Filz()
use NAME
if (fcount() = 3) // Not own ADDRESS1 and ADDRESS2
aDBF:= {}
aadd (aDBF,{"LASTNAME", "C", 10, 0})
aadd (aDBF,{"FIRSTNAME", "C", 10, 0})
aadd (aDBF,{"MID", "C", 1, 0})
aadd (aDBF,{"ADDRESS1", "C", 40, 0})
aadd (aDBF,{"ADDRESS2", "C", 40, 0})
dbcreate ('TEMP.DBF', aDBF)
endif
FixFile ()
return
//-------------------------------------------------------------------------
procedure FixFile()
select 1
use NAME
select 2
use TEMP
select 1
go top
do while .not. eof()
select 2
append blank
replace LASTNAME with 1->LASTNAME
replace FIRSTNAME with 1->FIRSTNAME
replace MID with 1->MID
select 1
skip
end
ferase ('NAME.DBF')
rename ('TEMP.DBF') to ('NAME.DBF')
return
--- FidoPCB v1.5 beta-'e'
---------------
* Origin: Innovatron, St-Boniface, QC (819)535-9072 (1:167/420)
|