Product Documentation

c-treeDB API for C# - Developers Guide

Previous Topic

Next Topic

Adding an Existing Table Under Transaction Control

An extra level of data integrity can be achieved when you add an existing table to a database under transaction control. When the transaction is committed, the database dictionary data for the table is committed to disk. If the transaction is aborted, the dictionary data for the table is automatically removed from the database dictionary.

The code fragment below shows how to add an existing table under transaction control.

// begin a transaction

ADatabase.Begin();

try

{

// add MyTable to the current database

ADatabase.AddTable("MyTable", "");

// commit the transaction

ADatabase.Commit();

}

catch (CTException err)

{

// abort the transaction

ADatabase.Abort();

Console.Write("Add table failed with code {0}\n", err.GetErrorCode());

}

TOCIndex