Product Documentation

VCL/CLX Developers Guide

Previous Topic

Next Topic

Closing a Table

After a successful open table, and the table handle is no longer needed, the table should be closed to allow all c-treeDB, c-tree Plus and operating systems buffers to be flushed to disk. It is very good programming practice to always close every open table before the process or thread is terminated.

A table is closed by setting its Active property to false or by calling the Close() method.

Delphi Example


procedure Form1.OpenTable();

begin

try

CtTable1.Table := 'MyTable';

CtTable1.Database := CtDatabase1;

CtTable1.Active := True;

// some other table operations

CtTable.Active := False;

except

on E : ECtError do

Application.ShowException(E);

end;

end;

C++ Example


void Form1::OpenTable()

{

try

{

CtTable1->Table = "MyTable"

CtTable1->Database = CtDatabase1;

CtTable1->Active = True;

// some other table operations

CtTable1->Active = False;

}

catch (ECtError& E)

{

Application->ShowException(&E);

}

}

TOCIndex