RDD

DbCopy()

Copy selected records to a new database file

Syntax

Signature
DbCopy( cFile, [aFields], [bFor], [bWhile], [nNext], [nRecord], [lRest], [cRDD] ) --> lSuccess

Arguments

cFile

Destination database file.

aFields

Optional field-name list.

bFor

, bWhile, nNext, nRecord, lRest Optional record-scope controls.

cRDD

Optional database driver name.

Return value

.T. when the file is created successfully; otherwise .F..

Description

DbCopy() creates a new database file with the selected fields and copies the records selected by the scope arguments from the current work area.

Notes

The destination file must be writable. The current work area stays open.

Example

DbCopy.prg
PROCEDURE Main()

   DbCreate( "copy_source.dbf", { { "NAME", "C", 12, 0 } } )
   DbUseArea( .T., , "copy_source.dbf", "People" )
   DbAppend()
   FieldPut( 1, "Anna" )
   DbCommit()
   QOut( "Copied: " + IIF( DbCopy( "people_copy.dbf" ), "YES", "NO" ) )
   DbCloseArea()
   FErase( "copy_source.dbf" )
   FErase( "people_copy.dbf" )


   RETURN

Output

See also