Product Documentation

VCL/CLX Developers Guide

Previous Topic

Next Topic

Dropping a Database from the Session

A database that is dropped from the session is eliminated from the session dictionary (the user is no longer able to connect to it), but it is kept on disk. It is possible to add back a dropped database to a session. Use the following procedure to drop 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 DropDatabase() method.

Delphi Example


procedure Form1.DropDatabaseFromSession;

begin

try

CtDatabase1.Database := 'MyData';

CtDatabase1.Session := CtSession1;

CtDatabase1.DropDatabase();

except

on E : ECtError do

Application.ShowException(E);

end;

end;

C++ Example


void Form1::DropDatabaseFromSession()

{

try

{

CtDatabase1->Database = "MyData";

CtDatabase1->Session = CtSession1;

CtDatabase1->DropDatabase();

}

catch (ECtError& E)

{

Application->ShowException(&E);

}

}

TOCIndex