<< Click to Display Table of Contents >> Navigation: Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods > CreateFrom |
Declaration
function CreateFrom( sNewFileName, sStruExteFileName : String;
iRDEType : Integer ) : WordBool;
Description
Creates a new file from the structure extended file specified in the sStruExteFileName parameter.
Parameters
sNewFileName: The name of the new data table qualified with a complete path (for local tables) and extension.
sStruExteFileName: The name of the structure extended file, including full path (for local tables) and extension if desired. The structure extended file may be created with CopyStructureExtended or manually as long as it conforms to the following:
FIELD NAME TYPE LEN DEC
FIELD_NAME C 10 0
FIELD_TYPE C 1 0
FIELD_LEN N 5 0
FIELD_DEC N 3 0
When working with a remote table via Apollo Database Server, you may only create and read from tables within the same Database directory as specified in the DatabaseName property of the TApolloTable component making this method call. The remote client cannot specify a physical server drive/path location and must use the defined server alias instead. Any physical drive/path included in the sNewFileName or sStruExteFileName parameters will be ignored for remote tables.
iRDEType: One of the following manifest constants:
SDENTX 1 CA-Clipper compatible DBF-NTX driver
SDEFOX 2 FoxPro DBF-IDX/CDX driver
SDENSX 3 HiPer-SIx DBF-NSX driver
Return Value
True if successful or False if unsuccessful.
Delphi Example
The pseudo code below shows the steps required to modify an existing table:
with ApTbl do
begin
CopyStructureExtended( 'struc.dbf' );
Close;
TableName := 'struc.dbf';
Open;
// Modify, Delete and/or Add Field descriptors
Pack; // If field descriptors deleted
Close;
CreateFrom( 'newdbf', 'struc', SDEFOX );
AppendFrom( 'source', SDEFOX, '' );
DeleteFile( 'struc.dbf' );
end;
Field types should not be changed. If a field type is changed from character to numeric, for example, AppendFrom will not copy the contents of the old character field to the new numeric field.
See Also
AppendFrom, CopyStructure, CopyStructureExtended, CreateExec, CreateField, CreateNew