表里面的时间数据是这种格式: 2008-12-10 17:05:54.640我现在要筛选出  字段日期 与 用户选择的日期 相同的数据
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            DateTime time = Convert.ToDateTime(this.dateTimePicker1.Text);
            this.cryAccount.SelectionFormula = "{ComputerAccountInfo.Xtime}=" + time;   //筛选
            this.cryAccount.RefreshReport();        //刷新报表
        }
这样子报错,请问怎么做阿

解决方案 »

  1.   

    应该是你录入的时间到dateTimePicker1.Text的时间格式问题想你上面的数据库里面是2008-12-10 17:05:54.640 而我们录入的时候一般是2008-12-10,这两个时间是不相等的请问你是时间=时间,还是用between data and data
      

  2.   


    我现在用这种还是报错阿..string time1 = Convert.ToDateTime(this.dtpFrom.Text).ToString();
                string time2 = Convert.ToDateTime(this.dtpTo.Text).ToString();
                this.crvAccount.SelectionFormula = "{ComputerAccountInfo.Xtime} between '" +time1+ " ' and  '" + time2+"'" ;
     
     
    提示剩余文本不是公式的一部分。
      

  3.   

    哈,这个问题我也碰到过,不知为何?
    后来,只好用SQL过滤后,再传给报表
     rtp.DataSource=ds;(ds,就是过滤后的DAtaSet)
      

  4.   

    this.crvAccount.SelectionFormula = "{ComputerAccountInfo.Xtime} between '" +time1+ " ' and  '" + time2+"'" ;==》this.crvAccount.SelectionFormula = "{ComputerAccountInfo.Xtime} >=cdate('" +time1+ "') and {ComputerAccountInfo.Xtime} <=cdate('" + time2+"')" ;也可能是不要单引号~~
      

  5.   

    这个问题也碰到过,跟四楼一样,只好用SQL过滤后,再传给报表.