Product Documentation

VCL/CLX Developers Guide

Previous Topic

Next Topic

Dropping a Table from a Database

A table that is dropped from the database is eliminated from the database dictionary (the user is no longer able to retrieve its information from the database), but it is kept on the disk. It is possible to add back a dropped table to a database. Use the following procedure to drop a table from a database:

  1. Log on to a c-tree Plus session (please refer to “Log On to c-tree”).
  2. Connect to a database (please refer to “Connecting to a database”).
  3. Drop a TCtTable component on a form.
  4. Set the Table property to the table name.
  5. Set the Database property to the database component.
  6. Call the DropTable() method.

The code excerpts below represent a table being dropped from a database at run time. There is no way to drop a table at design time.

Delphi Example


procedure Form1.DropTableFromDatabase();

begin

try

CtTable1.Table := 'MyTable';

CtTable1.Database := CtDatabase1;

CtTable1.DropTable();

except

on E : ECtError do

Application.ShowException(E);

end;

end;

C++ Example


void Form1::DropTableFromDatabase()

{

try

{

CtTable1->Table = "MyTable"

CtTable1->Database = CtDatabase1;

CtTable1->DropTable();

}

catch (ECtError& E)

{

Application->ShowException(&E);

}

}

TOCIndex