xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

DbCopyStruct()

Creates a new database based on the current database structure.

Syntax

DbCopyStruct( <cDatabase>, [<aFieldList>] ) --> NIL

Arguments

<cDatabase>
This is a character expression holding the name of the database file to create. It can include path and file extension. When no path is given, the file is created in the current directory.
<aFieldList>
Optionally, a one dimensional array can be specified which contains the field names of the current work area to include in the new database. If <aFieldList> is omitted, all fields are included.

Return

The return value is always NIL.

Description

Function DbCopyStruct() create a new, empty database file with a structure that is based on the database currently open in a work area. If <aFieldList> is empty, the new file has the same structure as the open database. Otherwise, the new file contains only the fields listed in <aFieldList>.

DbCopyStruct() can be used to create a subset of the currently open database, based on a given field list.

Info

See also:COPY STRUCTURE, COPY STRUCTURE EXTENDED, DbCopyExtStruct(), DbCreate(), DbStruct()
Category: Database functions , xHarbour extensions
Source:rdd\dbstrux.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example creates a new database holding only two fields of
// the Customer database.

   PROCEDURE Main

     USE Customer
     DbCopyStruct( "Test.dbf", { "Firstname", "Lastname" } )

     USE Test
     APPEND FROM Customer

     Browse()

     USE
  RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe