getList parameter data type of UInt32 is invalid

  • Updated

Using getList may generate an error ( The parameter data type of UInt32 is invalid ) because of a Microsoft SQL bug in Framework 4.5. This can occur in any Framework API getList call with the ContentManager, FolderManager, TaxonomyManager, and so on. 

SQL interprets a value passed into a getList call as an object rather than a long so the error occurs.

long taxid = 2147473650;
var TaxonomyCRUD = new TaxonomyManager();
var criteria = new TaxonomyCriteria();
criteria.AddFilter(TaxonomyProperty.ParentId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, taxid);
criteria.ReturnRecursiveChildren = false;
criteria.OrderByField = TaxonomyProperty.Name;
criteria.OrderByDirection = Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending;
criteria.PagingInfo = new Ektron.Cms.PagingInfo(50, 1);
var ChildCategoryList = TaxonomyCRUD.GetList(criteria);

If you declare the long value before passing it into getList , it should work normally as shown in the following example.  

long taxid = 2147473650;
var TaxonomyCRUD = new TaxonomyManager();
var criteria = new TaxonomyCriteria();
criteria.AddFilter(TaxonomyProperty.ParentId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, taxid);
criteria.ReturnRecursiveChildren = false;
criteria.OrderByField = TaxonomyProperty.Name;
criteria.OrderByDirection = Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending;
criteria.PagingInfo = new Ektron.Cms.PagingInfo(50, 1);
var ChildCategoryList = TaxonomyCRUD.GetList(criteria);