*********************************************************
** VFP-6 utilities (see no warranty at bottom)
** Author : Subramanian.G
** E-mail: ramani_g@yahoo.com
**
** Used at development time to copy DATABASE files from
** one project to another project
** specify FROM DBC & TO DBC with full path
*********************************************************
** Method to operate...........
** Keep this routine in the project directory as "CopyDbf.prg"
** From the command window issue DO CopyDbf
**
** I had kept the collection of all my utils in a Prcedural file
** and used to call it from that collection.
*********************************************************
** PROCEDURE gs_CopyDBF
DEFINE WINDOW MYWINDOW FROM 5,0 TO 20,80 COLOR SCHEME 5
ACTIVATE WINDOW MYWINDOW
STORE SPACE(40) TO tFromDBC, tToDBC, tDBFname && suitably increase size to your needs
@ 2,5 SAY "Select Source DBC with full path : " Get tFromDBC
@ 4,5 SAY "Select Destination DBC with path : " Get tToDBC
@ 6,5 SAY "Select Source DBF Database name : " Get tDBFname
USE (tToDBC+".DBC") IN 1 ALIAS new
SELECT new
PACK
GO BOTTOM
lnNewId = RECCOUNT()+1
lnParentId = lnNewId
USE (tFromDBC+".DBC") IN 2 ALIAS old
SELECT old
PACK
LOCATE FOR ALLTRIM(UPPER(OBJECTNAME)) == ALLTRIM(UPPER(tDBFNAME))
lnObjectId = ObjectId
SCATTER MEMVAR MEMO
m.ObjectId = lnNewId
SELECT new
APPEND BLANK
GATHER MEMVAR MEMO
SELECT old
SCAN FOR ParentId = lnObjectId
SCATTER MEMVAR MEMO
lnNewId = lnNewId+1
m.ObjectId = lnNewId
m.ParentId = lnParentId
SELECT new
APPEND BLANK
GATHER MEMVAR MEMO
SELECT old
ENDSCAN
CLOSE DATABASES ALL
DEACTIVATE WINDOW MYWINDOW
RETURN
** ENDPROC
*********************************************************
** End
*********************************************************
** NO IMPLIED OR EXPLICITY WARRANTY FOR ABOVE.
** USE TO YOUR CONVENIENCE
** DISTRIBUTE WITH THIS NOTE and in complete.
** Any modification, if you feel, is useful for community,
** please be kind to e-mail me - ramani_g@yahoo.com
*********************************************************
- Ramani
Subramanian.G, FoxAcc Software, (ramani_g@yahoo.com)
********************************************************
Evaluate this to make others know how useful is this
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.