日期:2014-05-17  浏览次数:20798 次

根据DatetimePicker数据查询
在C# winfrom access数据库中根据两个DatetimePicker 查询中间的数据绑定dataGridView 纠结拉半天 错误是

语法错误 (操作符丢失) 在查询表达式 'checktime betwenn>='2011-03-06 05:03:10'and'' checktime like<='2012-03-06 05:03:10'' 中。
求高手解决!!!

------解决方案--------------------
and后面多了两个单引号,
------解决方案--------------------
什么乱七八糟的
改为
checktime betwenn DatetimePicker1.Value and DatetimePicker2.Value
------解决方案--------------------
探讨

还是不行,我在WINFROM里面是这样写的
string sql = "select checktime,checktype,userid from checkinout where checktime betwenn>='" + this.dateTimePicker1.Value.ToString("yyyy-MM-dd hh:MM:ss") + "'and'" + "' chec……