Product Documentation

VCL/CLX Developers Guide

Previous Topic

Next Topic

Deleting a Database

A database that is deleted from the session is eliminated from the session dictionary (the user is no longer able to connect to it) and also from disk. Use the following procedure to delete a database from a session at run time:

  1. Log on to a c-tree Plus session (refer to “Log On to c-tree”).
  2. Drop a TCtDatabase component on a form.
  3. Set the Database property to the database name.
  4. Set the Session property with the Session component.
  5. Call the DeleteDatabase() method.

Delphi Example


procedure Form1.DeleteDatabase;

begin

try

CtDatabase1.Database := 'MyData';

CtDatabase1.Session := CtSession1;

CtDatabase1.DeleteDatabase();

except

on E : ECtError do

Application.ShowException(E);

end;

end;

C++ Example


void Form1::DeleteDatabase()

{

try

{

CtDatabase1->Database = "MyData";

CtDatabase1->Session = CtSession1;

CtDatabase1->DeleteDatabase();

}

catch (ECtError& E)

{

Application->ShowException(&E);

}

}

TOCIndex