DbCopyStruct Function | |
Create an empty database file with field definitions from another database file.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION DbCopyStruct(
cTargetFile AS STRING,
acStruct AS ARRAY
) AS LOGIC
public static bool DbCopyStruct(
string cTargetFile,
[DefaultParameterValueAttribute(null, 0)] Array acStruct
)
Request Example
View SourceParameters
- cTargetFile
- Type: String
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 cTargetFile does not exist, it is created.
If it exists, this function 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.
DBCopyStruct() creates the specified file in ANSI or OEM character set format, based on the SetAnsi() setting. (For more information, refer to the SetAnsi() function.)
- acStruct
- Type: Array
A one-dimensional array of field names to copy to the new database file.
The default is all fields.
Return Value
Type:
Logic
TRUE if successful; otherwise, FALSE.
Remarks
By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying
it within an aliased expression
DBCopyStruct() is the functional equivalent of the COPY STRUCTURE command.
Examples
The following example copies the structure of the current database file to a new database file:
1USE Test NEW
2IF Used()
3 DBCopyStruct("c:\savestru\test")
4ENDIF
See Also