請看看這個問題﹖

glodme7758 2004-04-06 04:32:12
conn.execute"delete from learning where articleid="&request("id")
執行這個語句時總是出現如下的錯誤﹕
此處需要物件: ''
請問錯在什么地方﹖
...全文
41 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
bguest 2004-04-07
  • 打赏
  • 举报
回复
有无试过直接这样执行?这样也会出错吗?
strSql="delete from learning where articleid=2"
conn.execute strSql
另外,只是delete这样吗?其他的select,insert,update操作有无试过?数据库的连接上有无问题?会出现“此處需要物件”通常是由于缺少操作对象等引起的,并不一定是语句上面的错误,尤其是asp代码,提示这样错误往往是由其他地方引起的。
dicklee1214 2004-04-06
  • 打赏
  • 举报
回复
request("id")是危险的,因为request有好几个动作集合(form,querystring,serverviabled等),而id有是一个极为通用的变量名称,很有可能渠道的并不是你想要的id值!除此之外同意变量类型的考虑!如bguest(bguest) 所言
bguest 2004-04-06
  • 打赏
  • 举报
回复
'测试你的sql语句
strSql="delete from learning where articleid="&request("id")
response.write strSql '看这里显示什么
conn.execute strSql
sxsgssgs 2004-04-06
  • 打赏
  • 举报
回复
id=Request.QueryString("id")
conn.execute"delete from learning where articleid="&Cint(id)
wzlove 2004-04-06
  • 打赏
  • 举报
回复
conn.execute"delete from learning where articleid="&request("id")
改成
id=request("id")
如果id是字符串类型就改成这样
conn.execute"delete from learning where articleid='"&id&"'"
如果id是数字类型
conn.execute"delete from learning where articleid="&id
bguest 2004-04-06
  • 打赏
  • 举报
回复
"&request("id") 你这个变量的类型?
如果是字符串类型就得改成这样

conn.execute"delete from learning where articleid='"&request("id")&"'"
glodme7758 2004-04-06
  • 打赏
  • 举报
回复
快幫忙啊,解決這個簡單問題不甚感謝

28,398

社区成员

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

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