Hello guys,
I have a piece of code which looks something like this :
QueryExpression queryname = new QueryExpression(entityname);
queryname.ColumnSet = new ColumnSet(fieldnames);
queryname.Criteria.AddCondition(new ConditionExpression(condition));
EntityCollection collectionName = _service.RetrieveMultiple(queryname);
if (collectionName.Entities.Count > 0)
{
tracingService.Trace("into method - 1, EC Count :" + collectionName.Entities.Count);
foreach (Entity entityname in productThresoldRecords.Entities)
//businesslogic..
I am getting an error in the foreach line - "Specified cast is not valid.".(Confirmed by the error log - the above trace is displayed . But the first trace in the foreach method is not..)
I can't figure out why I would get that error.Could it be because of the count of entity collection? Usually it is 1..
*This post is locked for comments