在C# winfrom   access数据库中根据两个DatetimePicker  查询中间的数据绑定dataGridView   纠结拉半天  错误是语法错误 (操作符丢失) 在查询表达式 'checktime betwenn>='2011-03-06 05:03:10'and'' checktime like<='2012-03-06 05:03:10'' 中。
求高手解决!!!

解决方案 »

  1.   

    什么乱七八糟的
    改为
    checktime betwenn DatetimePicker1.Value and DatetimePicker2.Value
      

  2.   

    还是不行,我在WINFROM里面是这样写的
    string sql = "select checktime,checktype,userid from checkinout where  checktime betwenn>='" +    this.dateTimePicker1.Value.ToString("yyyy-MM-dd hh:MM:ss") + "'and'" + "' checktime like<='" + this.dateTimePicker2.Value.ToString("yyyy-MM-dd hh:MM:ss") + "'";
        得到的错误是    语法错误 (操作符丢失) 在查询表达式 'checktime betwenn>='2011-03-06 05:03:10'and'' checktime like<='2012-03-06 05:03:10'' 中。
      

  3.   


    你这and 后面没有空格
    改成这样
    string sql = "select checktime,checktype,userid from checkinout where checktime betwenn>='" + this.dateTimePicker1.Value.ToString("yyyy-MM-dd hh:MM:ss") + "'and checktime like<='" + this.dateTimePicker2.Value.ToString("yyyy-MM-dd hh:MM:ss") + "'";