删除图片问题

ark1994 Manager  2004-04-06 02:03:43
我的代码如下:
浏览:Index.asp
<%
set con=server.CreateObject("ADODB.connection")
set rs=server.createobject("ADODB.recordset")
con.ConnectionString="driver={Microsoft Access Driver (*.mdb)};DBQ=" &server.MapPath("img.mdb")
con.Open
str="select * from img"
rs.open str,con,1,1
%>
<html>
<head><title>魏老师数码工作室</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="2" bgcolor="#E8E8FB">
<tr>
<td>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="800" height="100">
<param name="movie" value="Logo.swf">
<param name="quality" value="high">
<embed src="Logo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="800" height="100"></embed></object></td>
</tr>
</table>
<form action="del.asp" name="form1" method="post">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td align="center">
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#000000" bordercolordark="#ffffff" bgcolor="#9999FF" class="titleother">
<tr>
<td width="15%" align="center">编号</td>
<td width="12%" align="center">照片</td>
<td width="36%" align="center">操作</td>
<td width="37%" align="center">说明</td>
</tr>
</table>
</td>
</tr>
<tr align="center" bgcolor="#9999FF">
<%
i=1
do while not rs.eof
%>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="15%" align="center" bgcolor="#FFFFFF"><input name="flag" type=checkbox value="<%=rs("id")%>"></td>
<td width="12%" bgcolor="#FFFFFF"><a href="http://localhost/incoming/<%=rs("img")%>" target="_blank">
<img border="0" src="incoming/<%=rs("img")%>" width="95" height="75"></a></td>
<td width="36%" align="center" bgcolor="#FFFFFF"><input type="submit" value="删除" name="submit"></td>
<td width="37%" align="center" bgcolor="#FFFFFF"> </td>
</tr>
</table>
</td>
<%
if (i mod 1 = 0) then
response.write "</tr><tr align=center bgcolor=9999FF>"
end if
i=i+1
rs.MoveNext
loop
%>
</tr>
</table>
</form>
<table width="800" border="0" align="center" cellpadding="10" cellspacing="0">
<Tr>
<td align="center" bgcolor="#FFFFFF"> </td>
</Tr>
<Tr>
<td align="center" bgcolor="#FFFFFF"> </td>
</Tr>
<Tr>
<td align="center" bgcolor="#FFFFFF"><a href="upload.htm">上传新的照片</a></td>
</Tr>
</table>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF" class="csbn">
<tr>
<td width="394" align="right">版权所有</td>
<td width="406">© 2004,魏老师数码工作室</td>
</tr>
<tr>
<td align="right">和我联系</td>
<td><a href="mailto:htd4182@vip.sina.com">htd4182@vip.sina.com</a> </td>
</tr>
</table>
</td>
</tr>
</table>
</body></html>

删除:del.asp

<%
set con=server.CreateObject("ADODB.connection")
set rs=server.createobject("ADODB.recordset")
con.ConnectionString="driver={Microsoft Access Driver (*.mdb)};DBQ=" &server.MapPath("img.mdb")
con.Open
FOR EACH flag in request.form("flag")
str="delete * from img where id='"&flag&"'"
rs.open str,con,1,1
next
con.Close
Set rs = Nothing
Set con = Nothing
%>
在rs.open str,con,1,1处报错,各位高手帮帮我!!
...全文
22 点赞 收藏 1
写回复
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
miller530 2004-04-06
id字段是不是自动编号?
如是就改成 where id=" & flag
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告