惠州华康骨伤医院坑人:Acesss 转到SQL 出错

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/02 08:10:30
Acess: Sql = "select TOP 1 * from [Ke_FluxTJ] Where datediff('d',TodayDate,'"&Now&"')= 0"
SQL: Sql = "select TOP 1 * from [Ke_FluxTJ] Where datediff('d',TodayDate,'#"&Now&"#')= 0"
TodayDate 在Acess 中的默认值为:Date()
...
错误提示:

Microsoft OLE DB Provider for SQL Server 错误 '80040e14'

为 datediff 指定了无效的参数 1。

/inc/Ke_Class.asp,行 256

access DateDiff('d',Time1,Time2)
sql里的
DATEDIFF
返回跨两个指定日期的日期和时间边界数。
语法
DATEDIFF ( datepart , startdate , enddate )

例:DateDiff(d,Time1,Time2)
但是sql中没有now()要用getdate()
请看
http://www.xishui.net/info/2006-2/2006-2-28-2902.htm