为什么有时请求这个方法 结果的数量不一样呢?
        [WebMethod(EnableSession = true)]
        public List<string> GetRUIDList(string beginDate, string endDate)
        {
            List<string> ruidLst = new List<string>();
            DataAccess da = new DataAccess();
            string table = "S_DO4";
            string field = "RUID";
            string where = String.Format(" CREATETIME >= '{0}' AND CREATETIME < '{1}' AND TYPECODE={2} ", beginDate, endDate, DOCODE);
            DataSet dsRuid = da.GetTableValue(table, field, where);
            for (int i = 0; i < dsRuid.Tables[0].Rows.Count; i++)
            {
                ruidLst.Add(dsRuid.Tables[0].Rows[i][0].ToString());
            }
            return ruidLst;

解决方案 »

  1.   

    没错啊  CREATETIME >= '{0}' AND CREATETIME < '{1}'
     CREATETIME >= '2012-1-1' AND CREATETIME < '2012-1-2'
      

  2.   

    CREATETIME >= '2012-1-1' AND CREATETIME < '2012-1-2'这个请注意不是时间上的比较,而是字符串的比较,如果createtime为2012-01-2,此时按你的想法是应该查询出来的,但很遗憾,由于你的是字符串,则查询不出来了,因为2012-01-2<2012-1-1,看看你的问题是不是出在这里?
      

  3.   

    感觉时间比较没问题。
    string beginDate, string endDate
    每次传过来的参数是不是一样?DOCODE
    这个东西没看到赋值,是不是每次值都不一样
      

  4.   


    sql语句,sql server会把字符串转成DateTime的。