none
ConditionExpression.Values数组长度是否有限制? RRS feed

  • 问题

  • 我给values赋值为一个string[]类型数组,当数组里面的值达到几千条之后就会报错,一般的sql错误,请问这个长度是否有限制啊?是否还有其他的解决方法?代码如下:
                //获取字段
                ColumnSet cols = new ColumnSet();
                cols.Attributes = new string[] { "accountid","name","new_fundcode","new_i_clientflag","new_c_certtype","new_c_certno",
                    "emailaddress1","new_vc_mobile","ownerid" };

                //增加排序
                OrderExpression order = new OrderExpression();
                order.AttributeName = "createdon";
                order.OrderType = OrderType.Ascending;
                OrderExpression[] orders = new OrderExpression[] { order };

                //直销客户     
                ConditionExpression condition = new ConditionExpression();
                condition.AttributeName = "accountid";
                condition.Operator = ConditionOperator.In;
                condition.Values = GetDirectSaleAccount();//这里赋值是个string[]数组,一旦达到上千条就会报错


                //去除已经存在的
                ConditionExpression condition0 = new ConditionExpression();
                condition0.AttributeName = "accountid";
                condition0.Operator = ConditionOperator.NotIn;
                condition0.Values = GetExistsAccount();

                //个人客户
                ConditionExpression condition1 = new ConditionExpression();
                condition1.AttributeName = "new_i_clientflag";
                condition1.Operator = ConditionOperator.Equal;
                condition1.Values = new Object[] { 1 };

                //身份证的
                ConditionExpression condition2 = new ConditionExpression();
                condition2.AttributeName = "new_c_certtype";
                condition2.Operator = ConditionOperator.Equal;
                condition2.Values = new Object[] { 1 };

              
                //过滤条件
                FilterExpression filter = new FilterExpression();
                filter.FilterOperator = LogicalOperator.And;
                if(condition0.Values != null)
                    filter.Conditions = new ConditionExpression[] { condition,condition0, condition1, condition2 };
                else
                    filter.Conditions = new ConditionExpression[] { condition,condition1, condition2 };

                QueryExpression query = new QueryExpression();
                query.EntityName = EntityName.account.ToString();                //获取数据的实体名
                query.ColumnSet = cols;                                          //需要获取值的列名集合
                //query.ColumnSet = new AllColumns();                              //获取所有字段
                query.Orders = orders;                                           //排序条件
                query.Criteria = filter;                                         //筛选条件

                BusinessEntityCollection account = Method.RetrieveMultiple(query);
                return account;


    未将对象引用设置到对象的实例
    2009年12月25日 10:10

全部回复