28,391
社区成员
发帖
与我相关
我的任务
分享
<!--#include file=conn.asp-->
<!--#include file=cookies.asp-->
<%
'Split 函数 '返回一个从零开始的一维数组,其中包含指定数量的子字符串。
'UBound 函数 '返回指定数组维数的最大可用下标。
id=trim(request("selectedid"))
str2=split(id,",")
for i=0 to ubound(str2)
e=cint(trim(str2(i))) 'ID
response.Write "<li>"&e 'ID 输出信息,以便验证
'查找
set rstp=server.createobject("adodb.recordset")
sqltp="select * from xinxi where id="&e&""
rstp.open sqltp,conn,3,2
'输出信息,以便验证
response.Write "<li>"&sqltp 'SQL语句
response.write "<li>"&rstp.eof '是否到最后,老是得到true,就是找不到数据
'删除
exec="delete * from xinxi where id="&e&""
conn.execute exec
response.write "<li>删除信息成功!——"&e 'ID
next
Erase str2 '释放数组,不知道对吗
response.write "<meta http-equiv=refresh content=""2;URL=xinxi.asp"">"
response.End()
%>
exec="delete * from xinxi where id="
sqltp="select * from xinxi where id="
for each id in request("selectedid")
Set rstp = conn.Execute(sqltp&id) '查找记录
If Not rstp.Eof Then '如果有此条记录
'...这里进行删除图片等操作
conn.execute(exec&id)
End If
next
exec="delete * from xinxi where id="
sqltp="select * from xinxi where id="&e&""
for each id in request("selectedid")
Set rstp = conn.Execute(sqltp&id) '查找记录
If Not rstp.Eof Then '如果有此条记录
'...这里进行删除图片等操作
conn.execute(exec&id)
End If
next
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file=conn.asp-->
<!--#include file=cookies.asp-->
<%
'定义变量
Dim id,str2
Dim i,e
Dim rstp,exec
id = Trim(Request("selectedid"))
str2 = Split(id,",") '将ID存入数组
For i = 0 To Ubound(str2) '循环取出ID号 进行删除处理
e = Cint(Trim(str2(i)))
Set rstp = conn.Execute("select * from xinxi where id=" & e) '查找记录
If Not rstp.Eof Then '如果有此条记录
'...这里进行删除图片等操作
conn.Execute("delete * from xinxi where id=" & e) '删除整条记录 如果是SQL数据库 去掉*号
Response.Write("<li>删除信息成功!——" & e)
End If
Next
Set rstp = Nothing
Response.Write("<meta http-equiv=refresh content=""2;URL=xinxi.asp"">")
Response.End()
%>