[求助]各位帮我看看这个为什么错啊?????

lxxstarii 2003-10-17 03:46:10
conn.execute("delete online where time<#"&dateadd("n",-session.timeout,now)&"#")
sql="SELECT * from online where time>#"&dateadd("n",-session.timeout,now)&"#"

我用的是ASP和SQLSERVER的数据库。。。
这个为什么错啊??????????
帮帮忙啊。。。

Microsoft OLE DB Provider for SQL Server (0x80040E14)
第 1 行: '15' 附近有语法错误。
/liuyan/bottom.asp, 第 41 行
...全文
32 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
stefli 2003-10-17
  • 打赏
  • 举报
回复
sql="SELECT * from online where time>#"&dateadd("n",-session.timeout,now)&"#"
改为:
sql="SELECT * from online where time>'"&dateadd("n",-session.timeout,now)&"'"

记住,在sql中,时间用'单引号
在access中,时间用#
lxxstarii 2003-10-17
  • 打赏
  • 举报
回复
顶,,,,,,,,
lovehwq21 2003-10-17
  • 打赏
  • 举报
回复
conn.execute("delete online where time<'#"&dateadd("n",-session.timeout,now)&"#'")
sql="SELECT * from online where time>'#"&dateadd("n",-session.timeout,now)&"#'"
这样吧,你把语句Reponse.write出来,拿到分析器看看能不能执行啊

28,390

社区成员

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

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