CTDatabase.GetTableCount() retrieves the number of tables associated with a database. CTDatabase.GetTableCount() returns -1 (minus 1) if the database is not connected or if the database object is invalid.
// display the number of tables in database
Console.Write("Number of tables: {0}\n", ADatabase.GetTableCount());