查询Access,选择七天内的记录
sql = "select * from cpd where createTime>="+ System.DateTime.Now.AddDays(-7).ToString();
上面是错误语句
应该怎样写?
sql = "select * from cpd where createTime>="+ System.DateTime.Now.AddDays(-7).ToString();
上面是错误语句
应该怎样写?
解决方案 »
- div 页面引入数据库数据后就会错乱
- 用户控件与网页存在不同的文件夹,发现用户控件怎么用不了?
- 90后的程序员。应该怎么走.
- 母版页中包含script脚本的问题,怎么设置src?
- 写xml文件
- 用window.opener打开新窗口,在新窗口加载时,刷新父窗口,我用window.opener.location.href = window.opener.location.href和window.opener
- 关于命名空间和引用的几个问题
- Access连接字符串错误
- 请问下各位大哥,这个东西怎么禁止
- 小菜一碟——一步一步用C#写论坛(开放源码)-4(附:绝世好文章)
- web用户自定义控件问题...
- 怎样返回运行aspx文件后的html,可以不放在虚拟目录下行吗?
更准确的应该是
sql = "select * from cpd where convert(char(10),createTime,112)>='"+ System.DateTime.Now.AddDays(-7).ToString()+"'";
2、access用 #
3、access用 between #time1# and #time2# 1、sql = "select * from cpd where createTime>=#"+ System.DateTime.Now.AddDays(-7).ToString() + "#";
or
2、sql = "select * from cpd where createTime between #"+ System.DateTime.Now.AddDays(-7).ToString() "# and #" + System.DateTime.Now.AddDays(-7).ToString() + "#";试试看可否
"select * from cpd where createTime>=#"+ System.DateTime.Now.AddDays(-7).ToString() + "#";