Show/Hide Toolbars

XSharp

NoteThis command is defined in a header file and will be preprocessed by the X# preprocessor to a function call. If you disable the standard header (-nostddefs) files then this command will not be available. If you tell the compiler to use a different standard header file (-stddef ) then this command may also be not available

Purpose

Create an empty database file with field definitions from the current database file.

Syntax

COPY STRUCTURE [FIELDS <idFieldList>] TO <xcTargetFile>

Arguments

FIELDS <idFieldList>The set of fields to copy to the new database structure in the order specified.  The default is all fields.

 

TO <xcTargetFile>The name of the target database file, including an optional drive, directory, and extension.  See SetDefault() and SetPath() for file searching and creation rules.  The default extension for database files is determined by the RDD .
 
If <xcTargetFile> does not exist, it is created.  If it exists, this command attempts to open the file in exclusive mode and, if successful, the file is overwritten without warning or error.  If access is denied because, for example, another process is using the file, NetErr() is set to TRUE.  

Examples

In this example, COPY STRUCTURE creates a temporary file.  After the user enters data into the temporary file, the master database file is updated with the new information:

 

USE sales NEW
COPY STRUCTURE TO temp
USE temp NEW
lMore := TRUE
DO WHILE lMore
  APPEND BLANK
  @ 10, 10 GET Temp->Salesman
  @ 11, 11 GET Temp->Amount
  READ
  IF Updated()
    SELECT sales
    APPEND BLANK
    REPLACE Sales->Salesman WITH Temp->Salesman
    REPLACE Sales->Amount WITH Temp->Amount
    SELECT Temp
    ZAP
  ELSE
     lMore := FALSE
  ENDIF
ENDDO
CLOSE DATABASES
 

Assembly

XSharp.RT.DLL

See Also

COPY STRUCTURE EXTENDED, CREATE, DbCopyStruct(), SetDefault(), SetPath()