C# 通过两个dateTimePicker控件查询ACCESS里的内容,怎么总是不行啊 10
stringstrSelect="select*fromjcmxwhererq>="+dateTimePicker1.Value.Date.ToString()+"and...
string strSelect = "select * from jcmx where rq >= " + dateTimePicker1.Value.Date.ToString() + " and rq<=" + dateTimePicker2.Value.Date.ToString() + " order by 编号 desc";
展开
展开全部
改成string strSelect = "select * from jcmx where rq >= '" + dateTimePicker1.Value.Date.ToString() + "' and rq<='" + dateTimePicker2.Value.Date.ToString() + "' order by 编号 desc";
或者string strSelect =string.format("select * from jcmx where rq >='{0}' and rq<='{1}' order by 编号 desc",dateTimePicker1.Value.Date.ToString() ,dateTimePicker2.Value.Date.ToString());
或者string strSelect =string.format("select * from jcmx where rq >='{0}' and rq<='{1}' order by 编号 desc",dateTimePicker1.Value.Date.ToString() ,dateTimePicker2.Value.Date.ToString());
展开全部
string strSelect = "select * from jcmx where rq >= #" + dateTimePicker1.Value.Date.ToString() + "# and rq<=#" + dateTimePicker2.Value.Date.ToString() + "# order by 编号 desc";
access里面的时间,要用 #2000-01-01#的格式来表示。
access里面的时间,要用 #2000-01-01#的格式来表示。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
rq是时间字段?
select * from jcmx where convert(datetime,rq) between datatime dateTimePicker1.Value.Date and dateTimePicker2.Value.Date order by 编号 desc
select * from jcmx where convert(datetime,rq) between datatime dateTimePicker1.Value.Date and dateTimePicker2.Value.Date order by 编号 desc
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询