求助!还是关于时间的搜索问题?

hety521 2003-12-25 10:54:38
sqlStr = "select * from imgbook where 1=1 "
sqlStr = sqlStr & " and cc_title like '%"&title&"%' "
sqlStr = sqlStr & " and cc_author like '%"&author&"%' "
sqlStr = sqlStr & " and cc_content like '%"&keyword&"%' "
sqlStr = sqlStr & " and classname like '%"&aclass&"%' "
我想在上面的代码中再加入按时间的搜索。我用了
sqlStr = sqlStr & " and cc_createtime between '"&stime&"' and '"&etime&"' "可是不行。哪位能给点帮助!谢谢了!
...全文
32 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
hety521 2003-12-25
  • 打赏
  • 举报
回复
谢谢了。现在问题解决了!特别感谢 :PPLUNCLE(转向.NET)现在马上给分哦。顺便祝大家圣诞快乐了。
RealDreamMan 2003-12-25
  • 打赏
  • 举报
回复
注意时间十分秒写法, createDate between and '"&StartDate&" 00:00:00.000'"
and '"&EndDate&" 23:59:59.000'"
hety521 2003-12-25
  • 打赏
  • 举报
回复
对了,我用的是access的数据库,好,我再改下试试啊
PPLUNCLE 2003-12-25
  • 打赏
  • 举报
回复
楼主是搜索不到还是有错误啊
楼主是用的什么数据库
如果用的是access的话
语句就得下面的写法:
sqlStr = sqlStr & " and cc_createtime between #"&stime&"# and #"&etime&"# "
sq0421 2003-12-25
  • 打赏
  • 举报
回复
如果不行就去掉这段

再用一个if rs("cc_createtime")>stime and rs("cc_createtime")<etime then

过滤
hety521 2003-12-25
  • 打赏
  • 举报
回复
还是不行啊。只要一加上这段就说搜不到!
hety521 2003-12-25
  • 打赏
  • 举报
回复
谢谢了。我试下啊
coolidea 2003-12-25
  • 打赏
  • 举报
回复
sqlStr = sqlStr & " and cc_createtime>'"&stime&"' and cc_createtime<'"&etime&"' "
注意你的字段类型和你的变量类型,如果不是日期型要先转为日期型

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧