模拟人生4如何建造2楼:ASP网页SQL语句提取sql数据库的今天的数据

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/30 11:34:12
是SQL数据库/。
addtime字段属性是:datetime
ASP存入数据库rs("addtime")=now()

现在要提取今日的数据:
这条语句怎么样修改?
rs.open"select * from b_title where datediff('d',addtime,now())=0 order by t_id desc",conn,1,1

请高手指教
大家出的方法都不行,我都试过啦

问题是我写进去的是rs("addtime")=now()
addtime属性是datetime

现在读出来好象不是时间日期格式

再请正确方法

rs.open "select * from b_title where datediff(' d ',addtime,getdate())=0 order by t_id desc",conn,1,1

在SQL 数据库中,获取当前时间的函数不是ACCESS中的NOW(),而是getdate()

你已经问过一次了吧
难道没用吗
那我再写一遍
rs.open "select * from f_user where reg_date=getdate() order by user_id desc",conn,1,1
或者
rs.open "select * from f_user where reg_date=#"date()"# order by user_id desc",conn,1,1
是不是要修改你的语句才算正确
rs.open"select * from b_title where datediff('" & d & "',addtime,now())=0 order by t_id desc",conn,1,1
d是个变量吧

rs.open "select * from house_r where datediff(day,add_date,getdate())=0",conn,1,1

写成这个样子就OK了。