Product Documentation

c-treeDB API for C# - Developers Guide

Previous Topic

Next Topic

Find Database by UID

The overloaded method CTSession.FindDatabase() locates a database given the database UID and retrieves the database name and path. The following example shows how to implement a database connect procedure using the database UID instead of the database name.


// Database Connect using UID

CTDatabase ConnectByUID(CTSession ASession, ULONG uid)

{

StringBuilder dbName = new StringBuilder();

StringBuilder dbPath = new StringBuilder();

CTDatabase Retval = null;


if (ASession.FindDatabase(uid, out dbName, out dbPath)

{

Retval = new CTDatabase(ASession);

if (Retval != null)

{

Retval.Connect(dbName);

}

else

{

throw CTException(CTDBRET_NOMEMORY);

}

}

else

{

throw CTException(FNOP_ERR);

}

return Retval;

}

TOCIndex