In the following code example, you can see how to get a DataSet with all custom tables in the system.
[C#]
using CMS.CMSHelper; using CMS.SettingsProvider; using CMS.SiteProvider; using CMS.DataEngine;
...
// Retrieve all custom tables from the database DataSet customTables = DataClassInfoProvider.GetCustomTableClasses(); |
This second code example demonstrates how only custom tables matching the specified criteria can be retrieved and saved in a DataSet.
[C#]
using CMS.CMSHelper; using CMS.SettingsProvider; using CMS.SiteProvider; using CMS.DataEngine;
...
string where = "ClassID > 5"; string orderBy = "ClassDisplayName"; int topN = 10; string columns = "ClassID, ClassDisplayName, ClassLastModified";
// Get custom tables according to the given criteria DataSet customTables2 = DataClassInfoProvider.GetCustomTableClasses(CMSContext.CurrentSiteID, where, orderBy, topN, columns); |
Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_getting_custom_tables.htm