Microsoft Dynamics CRM 4.0 实体的联查

血红的双手。 提交于 2020-03-28 16:28:14
  ConditionExpression cond = new ConditionExpression();
             cond.AttributeName = "new_nsrsbh";
             cond.Values = new object[] { "21010277460473X" };
             FilterExpression filter = new FilterExpression();
             filter.Conditions = new ConditionExpression[] { cond };
             filter.FilterOperator = LogicalOperator.And;
             
             LinkEntity link =new LinkEntity ();
             link.LinkFromEntityName = EntityName.new_dj_kh_hykxx.ToString();
             link.LinkFromAttributeName = "new_contactid";
             link.LinkToEntityName = EntityName.account.ToString();
             link.LinkToAttributeName = "primarycontactid";
             link.LinkCriteria = filter;

             QueryExpression query = new QueryExpression();
             query.EntityName = EntityName.new_dj_kh_hykxx.ToString();
             query.ColumnSet = new AllColumns();
             
         
             

             query.LinkEntities = new LinkEntity[] { link };
            

             BusinessEntityCollection entity = service.RetrieveMultiple(query);
             new_dj_kh_hykxx hyk = (new_dj_kh_hykxx) entity.BusinessEntities[0];
            
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!