Hi Roman,
Thanks for your reply. I'm sure I did follow the example in Developers guide step by step.
I used the example code in the Developers guide just to check
GetItems() method
but the result is still null.
I used another way to get data is Ok. but I want to know why i can't get the data by the
GetItems() method.
DataSet always return is null.
This is the code I used to check:
private bool GetAndUpdateCustomTableItem()
{
// Creates a new Custom table item provider
CustomTableItemProvider customTableProvider = new CustomTableItemProvider(CMSContext.CurrentUser);
string customTableClassName = "customtable.Test";
// Checks if Custom table 'Sample table' exists
DataClassInfo customTable = DataClassInfoProvider.GetDataClass(customTableClassName);
if (customTable != null)
{
// Gets the data set according to the parameters
DataSet dataSet = customTableProvider.GetItems(customTableClassName, null, null);
if (!DataHelper.DataSourceIsEmpty(dataSet))
{
// Gets the custom table item ID
int itemID = ValidationHelper.GetInteger(dataSet.Tables[0].Rows[0][0], 0);
// Gets the custom table item
CustomTableItem updateCustomTableItem = customTableProvider.GetItem(itemID, customTableClassName);
if (updateCustomTableItem != null)
{
return true;
}
}
}
return false;
}