The following code example shows how a DataSet with data items stored in a custom table can be retrieved.
[C#]
using System.Data; using CMS.CMSHelper; using CMS.SiteProvider;
...
string customTableClassName = "customtable.SampleTable"; string where = "ItemID > 5"; string orderBy = "ItemOrder"; int topN = 10; string selectedColumns = "ItemID, ItemCreatedBy, ItemModifiedBy";
// Create an instance of the Custom table item provider CustomTableItemProvider tableProvider = new CustomTableItemProvider(CMSContext.CurrentUser);
// Get a list of custom table items according to a WHERE condition DataSet ds = tableProvider.GetItems(customTableClassName, where, orderBy);
DataSet ds2 = tableProvider.GetItems(customTableClassName, where, orderBy, topN, selectedColumns); |
Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_getting_items_from_a_custom_table.htm