Product Documentation

c-treeDB API for C# - Developers Guide

Previous Topic

Next Topic

Find Table by UID

The overloaded method CTDatabase.FindTable() locates a table in the database given the table UID and retrieves the table name and path. The following example shows how to implement a table open function using the table UID instead of the table name.

Example

// open table using UID

CTTable OpenByUID(CTDatabase ADatabase, ULONG uid, OPEN_MODE OpenMode)

{

StringBuilder tblName = new StringBuilder();

StringBuilder tblPath = new StringBuilder();

CTTable Retval;

// locate the table in the database by uid

if (ADatabase.FindTable(uid, out tblName, out tblPath))

{

Retval = new CTTable(ADatabase);


if (!Retval)

throw CTException(CTDBRET_NOMEMORY);

try

{

Retval->Open(tblName.ToString(), OpenMode);

}

catch (CTException err)

{

throw;

}

}

else

{

// table not found

throw new CTException(INOT_ERR);

}

return Retval;

}

TOCIndex