帮忙找SQL数据库操作语句错误,耽误1分钟~谢谢

来源:百度知道 编辑:UC知道 时间:2024/06/15 02:24:20
这段代码有错么?高手帮帮忙

<%
dim id
if request("action")="deluser" then
id=request("id")
response.write killusername
conn.execute "delete from ygxx where id='"&id&"'"
response.write"<SCRIPT language=JavaScript>alert('你已删除了此帐号!');"
response.write"javascript:history.go(-2)</SCRIPT>"
rseponse.end
conn.close
end if
%>
这行代码操作了提示成功但是其实没删掉,inter选项-高级-显示友好HTTP错误勾上就显示HTTP-500内部服务器错误。哪的错。。

回复1楼:
有的。这个是作业,自己建网站能实现插入,查询和删除操作就行。。SQL我自己建的表。ID是主键。都是0001什么的。。

这样说太麻烦。。叫我QQ178906230,麻烦你了。。。

delete from ygxx where id='"%id%"

把(&)改为(%)
通常(%)都是与like匹配使用

但是你要删除这样恐怕有点危险

补:
delete from ygxx where id='"&id&"'"
看清楚了,你数据库里面有(&12&)这样的ID?

你的id在数据库里的数据类型是什么?是int么?如果是int那你应该把单引号拿掉。如果是string类话你的语句没错:

如果是int
dim sql
sql = "delete from ygxx where id="&id
conn.execute sql