psql.Append(string.Format(" and createday between {0} and {1}", this.txtCreatedayEnd.Text, this.txtCreatedayStart.Text));
  麻烦各位大虾帮忙看看这条语句这样写有错吗?为什么查不出来数据啊,createday是一个时间类型,我想用这条语句查出符合条件的在某一时间段中的数据。

解决方案 »

  1.   

    查不出数据你问谁啊,把sql放到查询分析器中试试
      

  2.   


    psql.Append(string.Format(" and createday between '{0}' and '{1}'", this.txtCreatedayEnd.Text, this.txtCreatedayStart.Text));时间要加单引号的
      

  3.   

    psql.Append(string.Format(" and createday between {0} and {1}", this.txtCreatedayEnd.Text, this.txtCreatedayStart.Text));// 估摸着需要颠倒下控件顺序
      

  4.   

    between '{0}' and '{1}'      //加个单引号试试
      

  5.   

    SQL server里面时间要用引号。
    Access里面时间要用#号
      

  6.   

    设置一个断点自己调试。这个东西语句怎么看的出来,没前没后的就一个属性BETWEEN 两个参数,再说你这两个参数还不一定符合你的数据库中数据类型定义呢