none
是我代码写错了,还是CrmwebService中的方法有问题? RRS feed

  • 问题

  •   ConditionExpression conditions = new ConditionExpression();
      conditions.AttributeName = "new_patientid";
      conditions.Operator = ConditionOperator.In;
      conditions.Values = new object []{85,90,23 };
      
      FilterExpression filter = new FilterExpression();
      filter.Conditions = new ConditionExpression[] { conditions };
      filter.FilterOperator = LogicalOperator.And;
      
      ColumnSet cols = new ColumnSet();
      cols.Attributes = new string[] {"new_patientid" };
        
      QueryExpression query = new QueryExpression();
      query.EntityName = EntityName.account.ToString();
      query.Criteria = filter;
      query.ColumnSet = cols;
      
      CrmService service = MSCRM_ConnectionHandler.InitWS();

      BusinessEntityCollection retrived = service.RetrieveMultiple(query);

      查处来的结果不对!!

    我跟踪了一下,发现它生成的sql语句中conditions.Values 没用上,都是空字符串

    就像 new_patientid=@new_patientid1 or new_patientid=@new_patientid2 or  new_patientid=@new_patientid3 

    这三个参数分别等于 空字符串

    @new_patientid1 =''

    @new_patientid2 =''

    @new_patientid3 =''

    如果 conditions.Values 属性的值用上的话,是查得出数据的

    @new_patientid1 ='85'

    @new_patientid2 ='90'

    @new_patientid3 ='23'  

    2010年5月10日 14:41