Hi,
I don't know which version of kentico you are using, but with the code bellow you can achive that in version 11. This should give you a good start how to use data from custom tables in kentico:
// Prepares the code name (class name) of the custom table
string customTableClassName = "customtable.sampletable";
// Gets the custom table
DataClassInfo customTable = DataClassInfoProvider.GetDataClassInfo(customTableClassName);
if (customTable != null)
{
// Gets a custom table record with a specific primary key ID (25)
CustomTableItem item1 = CustomTableItemProvider.GetItem(25, customTableClassName);
// Gets the first custom table record whose value in the 'ItemName' field is equal to "SampleName"
CustomTableItem item2 = CustomTableItemProvider.GetItems(customTableClassName)
.WhereEquals("ItemName", "SampleName")
.FirstObject;
// Loads a string value from the 'ItemText' field of the 'item1' custom table record
string itemTextValue = ValidationHelper.GetString(item1.GetValue("ItemText"), "");
}
Best regards,
Dragoljub