CreateExec

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

CreateExec

Declaration

function CreateExec: WordBool;

Description

Creates a table in the work area set up via CreateNew and according to the field specifications defined with CreateField.

 

This function is called as the last in a series of functions used to create a new table. CreateExec only operates upon the structure set up via a call to CreateNew (which sets up a new work area) and calls to CreateField which define the fields in the table.

 

The new file is physically created by CreateExec. If one or more memo fields have been defined with CreateField, a memo file with the same name as the DBF is created with an extension that reflects the driver in use (SDENTX - DBT, SDEFOX - FPT, SDENSX - SMT).

Return Value

True or False depending upon the outcome of the operation. It will be False if the preliminary operations have not been called success fully.

Delphi Example

procedure TForm1.Button1Click(Sender: TObject);

begin

 with ApTbl do 

 begin 

         if not CreateNew( 'c:\Apollo\Data\testnew.dbf', SDEFOX, 5 ) then 

         begin  

                 ShowMessage( 'Create failed' ); 

                 Exit; 

         end; 

         CreateField( 'fchar', 'C', 25, 0 ); 

         CreateField( 'fnum', 'N', 10, 2 ); 

         CreateField( 'flog', 'L', 1, 0 ); 

         CreateField( 'fdate', 'D', 8, 0 ); 

         CreateField( 'fmemo', 'M', 10, 0 ); 

         if CreateExec then

                   ShowMessage( 'Create succeeded' )

         else 

                 ShowMessage( 'Create failed' ); 

 end; 

end;

C++Builder Example

void __fastcall TForm1::Button1Click(TObject *Sender)

{

 if (!ApTbl->CreateNew( "c:\\Apollo\\Data\\testnew.dbf", SDEFOX, 5 )) 

 

         ShowMessage( "Create failed" ); 

         return; 

 

 ApTbl->CreateField( "fchar", "C", 25, 0 ); 

 ApTbl->CreateField( "fnum", "N", 10, 2 ); 

 ApTbl->CreateField( "flog", "L", 1, 0 ); 

 ApTbl->CreateField( "fdate", "D", 8, 0 ); 

 ApTbl->CreateField( "fmemo", "M", 10, 0 ); 

 if (ApTbl->CreateExec())

         ShowMessage( "Create succeeded" ); 

 else 

         ShowMessage( "Create failed" ); 

}

See Also

CopyStructure, CreateField, CreateNew