注册 登录
编程论坛 ASP技术论坛

不能同时删除两个或以上,提示错误,各位大侠有请~

天蝎风 发布于 2010-12-15 10:43, 520 次点击
仓库管理界面:
只有本站会员才能查看附件,请 登录


同时选择两项或以上,点击删除后就出现以下错误:
==================================================
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14'
[Microsoft][ODBC Microsoft Access Driver] 语法错误 (逗号) 在查询表达式 'id_ku=15, 14' 中。
/3/system/ku_del.asp,行 10

======================================================
代码如下:
程序代码:
<%if session("redboy_username")="" then%>
<script language="javascript">top.location.href="../index.asp"</script>
<%
  response.end
end if
%>
<!-- #include file="../conn2.asp" -->
<%
sql
="select * from produit where id_ku="&request("id")&""
set rs=conn.execute(sql)
if rs.eof=false then
%>
  <script language="javascript">
    alert(
"此仓库中还存有产品,不能删除!")
    window.history.go(
-1)
  
</script>
<%
  response.end
end if
id
=replace(request("id")," ","")
id
=split(id,",")
for i=0 to UBound(id)
  conn.execute(
"delete from produit where id_ku="&id(i))
  sql
="delete from ku where id="&id(i)
  conn.execute(sql)
next
response.redirect
"ku.asp"
%>


[ 本帖最后由 天蝎风 于 2010-12-15 10:45 编辑 ]
4 回复
#2
yms1232010-12-15 11:03
conn.execute("delete from produit where id_ku in ("&id(i)&")")
多个要用in不能用=号
#3
天蝎风2010-12-15 11:45
以下是引用yms123在2010-12-15 11:03:40的发言:

conn.execute("delete from produit where id_ku in ("&id(i)&")")
多个要用in不能用=号
大侠再帮我看一下:
程序代码:
<%if session("redboy_username")="" then%>
<script language="javascript">top.location.href="../index.asp"</script>
<%
  response.end
end if
%>
<!-- #include file="../conn2.asp" -->
<%
sql
="select * from produit where id_ku in ("&request("id")&")
set rs=conn.execute(sql)
if rs.eof=false then
%>
  <script language="javascript">
    alert(
"此仓库中还存有产品,不能删除!")
    window.history.go(
-1)
  
</script>
<%
  response.end
end if
id
=replace(request("id")," ","")
id
=split(id,",")
for i=0 to UBound(id)
  conn.execute(
"delete from produit where id_ku in ("&id(i)&")")
  sql
="delete from ku where id in "&id(i)
  conn.execute(sql)
next
response.redirect
"ku.asp"
%>
==================================Microsoft VBScript 编译器错误 错误 '800a0409'

未结束的字符串常量

/3/system/ku_del.asp,行 9

sql="select * from produit where id_ku in ("&request("id")&")
-------------------------------------------------------------^
#4
yms1232010-12-15 12:02
sql="select * from produit where id_ku in ("&request("id")&")"
#5
天蝎风2010-12-15 13:10
以下是引用yms123在2010-12-15 12:02:00的发言:

sql="select * from produit where id_ku in ("&request("id")&")"
OK了!谢谢版主yms123思密达,赏分!
1