CTSession::NextDatabase() will retrieve the name and path of the next database in a session. CTSession::NextDatabase() returns NO (false) when no more databases exist for the current session.
// display all databases in a session
CTDBRET DisplayDatabases(CTSession& ASession)
{
CTDBRET Retval = CTDBRET_OK;
try
{
CTString dbName;
CTString dbPath;
if (ASession.FirstDatabase(dbName, dbPath))
do
{
printf("Database: %s Path: %s\n", dbName.c_str(), dbPath.c_str());
}
while (ASession.NextDatabase(dbName, dbPath);
}
catch (CTException &err)
{
Retval = err.GetErrorCode();
}
return Retval;
}