asp 无法批量删除数据库记录 在线等 急 急 急
shujuku.asp代码<body><%setconn=server.CreateObject("ADODB.Connection")conn.open"dbq="&s...
shujuku.asp代码
<body>
<%
set conn=server.CreateObject("ADODB.Connection")
conn.open "dbq=" & server.mappath("kbcx.mdb") & ";Driver={microsoft access driver (*.mdb)}"
%>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open"select*from chaxun",conn,1,1
%>
<%
rs.pagesize=3
pagecount=rs.pagecount
page=int(request("page"))
if page<=0 then page=1
if request("page")=""then page=1
rs.absolutepage=page
%>
<div align="center">
<p>课表查询</p>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td height="30" width="80" bgcolor="#99CCCC" align="center">ID</td>
<td height="30" width="150" bgcolor="#99CCCC" align="center">日期</td>
<td height="30" width="80" bgcolor="#99CCCC" align="center">星期</td>
<td height="30" width="120" bgcolor="#99CCCC" align="center" >教员</td>
<td height="30" width="200" bgcolor="#99CCCC" align="center">课程</td>
<td height="30" width="80" bgcolor="#99CCCC" align="center">教室</td>
<td height="30" width="80" bgcolor="#99CCCC" align="center">节次</td>
</tr>
<% while not rs.eof and rowcount< rs.pagesize%>
<TR>
<% for i=1 to rs.fields.count-1%>
<TD height="25"><% =rs.fields(i).value
%></TD>
<% next%>
<td>
<input name="shanchu" type="checkbox" value="<%=rs("id")%>" />
</td>
</TR>
<%
rowcount=rowcount+1
rs.movenext
wend
%>
</table>
<p>★
<%for i=1 to pagecount%>
<%if i=page2 then%>
[<font color="#ff0000"><%=i%></font>]
<%else%>
[ <a href="shujuku.asp?page=<%=i%>"><%=i%></a>]
<%end if%>
<%next%> ★</p>
<form id="form1" name="form1" method="post" action="problemdelete.asp">
<a href="shujuku.asp?page=<%=i%>">
<input type="submit" name="button" id="button" value="提交" />
</a>
</form>
<p> </p>
<p><a href="shujuku.asp?page=<%=i%>"></a></p>
</body>
problemdelete.asp代码
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("kbcx.mdb")
count=request.form("shanchu").count
for i=1 to count
sql="delete from tableName where id in("&request("shanchu")&")"
conn.execute(sql)
next
conn.close
set conn=nothing
response.redirect "shujuku.asp"
执行后没有报错,但就是删除不了,高手帮忙看看到底什么地方错了 展开
<body>
<%
set conn=server.CreateObject("ADODB.Connection")
conn.open "dbq=" & server.mappath("kbcx.mdb") & ";Driver={microsoft access driver (*.mdb)}"
%>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open"select*from chaxun",conn,1,1
%>
<%
rs.pagesize=3
pagecount=rs.pagecount
page=int(request("page"))
if page<=0 then page=1
if request("page")=""then page=1
rs.absolutepage=page
%>
<div align="center">
<p>课表查询</p>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td height="30" width="80" bgcolor="#99CCCC" align="center">ID</td>
<td height="30" width="150" bgcolor="#99CCCC" align="center">日期</td>
<td height="30" width="80" bgcolor="#99CCCC" align="center">星期</td>
<td height="30" width="120" bgcolor="#99CCCC" align="center" >教员</td>
<td height="30" width="200" bgcolor="#99CCCC" align="center">课程</td>
<td height="30" width="80" bgcolor="#99CCCC" align="center">教室</td>
<td height="30" width="80" bgcolor="#99CCCC" align="center">节次</td>
</tr>
<% while not rs.eof and rowcount< rs.pagesize%>
<TR>
<% for i=1 to rs.fields.count-1%>
<TD height="25"><% =rs.fields(i).value
%></TD>
<% next%>
<td>
<input name="shanchu" type="checkbox" value="<%=rs("id")%>" />
</td>
</TR>
<%
rowcount=rowcount+1
rs.movenext
wend
%>
</table>
<p>★
<%for i=1 to pagecount%>
<%if i=page2 then%>
[<font color="#ff0000"><%=i%></font>]
<%else%>
[ <a href="shujuku.asp?page=<%=i%>"><%=i%></a>]
<%end if%>
<%next%> ★</p>
<form id="form1" name="form1" method="post" action="problemdelete.asp">
<a href="shujuku.asp?page=<%=i%>">
<input type="submit" name="button" id="button" value="提交" />
</a>
</form>
<p> </p>
<p><a href="shujuku.asp?page=<%=i%>"></a></p>
</body>
problemdelete.asp代码
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("kbcx.mdb")
count=request.form("shanchu").count
for i=1 to count
sql="delete from tableName where id in("&request("shanchu")&")"
conn.execute(sql)
next
conn.close
set conn=nothing
response.redirect "shujuku.asp"
执行后没有报错,但就是删除不了,高手帮忙看看到底什么地方错了 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询