请帮忙看看这个帖子

blues7 2003-10-17 05:35:43
http://expert.csdn.net/Expert/topic/2366/2366799.xml?temp=.5248072

我这样写
sql="delete from "&table&" where "&id_no&"='"&cstr(id)&"'"
报错
Incorrect syntax near the keyword 'where'.

把table换成表名,就报错
Line 1: Incorrect syntax near '='.


表名和字段都不用变量就没有错
请教该怎么解决,谢谢
...全文
32 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
blues7 2003-10-17
  • 打赏
  • 举报
回复
。。。。
果然table和id_no是空的,因为是本页面提交,变量设在了后面,昏!
非常感谢谢谢楼上的各位,谢谢
qdubit 2003-10-17
  • 打赏
  • 举报
回复
关注一下!
par 2003-10-17
  • 打赏
  • 举报
回复


请确定table及所有变量是否是空值.

如果不是空,可以这样试试:
sql="delete from ["&table&"] where ["&id_no&"]='"&cstr(id)&"'"
avonqin 2003-10-17
  • 打赏
  • 举报
回复
sql="delete from "&table&" where "&id_no&"='"&cstr(id)&"'"
问题出在你这个table和id_no变量正确是否,trim一下试试:
sql="delete from "&trim(table)&" where "&trim(id_no)&"='"&cstr(id)&"'"

如果还不行的话,
response.write table
response.write id_no
看看正确没有
kinglately 2003-10-17
  • 打赏
  • 举报
回复
加一句response.write ("table=" & table & "id_no=" & id_no)
看看和你想象中的一样否?
stefli 2003-10-17
  • 打赏
  • 举报
回复
你的id是什么类型的哦!
如果是数值型的,就去掉前面的'单引号哦
yangsm 2003-10-17
  • 打赏
  • 举报
回复
sql="delete from '"&table&"' where "&id_no&"='"&cstr(id)&"'"这样不行吗?
Reker熊 2003-10-17
  • 打赏
  • 举报
回复
輸出table和id_no變量
Reker熊 2003-10-17
  • 打赏
  • 举报
回复
輸入table和id_no變量,

28,390

社区成员

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

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