Microsoft VBScript 运行时错误 错误 '800a01a8'
缺少对象: 'conn'
/admin/delete.asp,行 217
数据库类型是 nvarchar
<!--#include file="../Connections/web.asp" -->
<SCRIPT language=JavaScript>
<!--
function CheckAll(v)
{
var i;
for (i=0;i<document.forms.elements.length;i++)
{
var e = document.forms.elements[i];
e.checked = v;
}
}
function OnDelete()
{
var del, a, i;
del = new String("");
for(i = 0; i < document.forms.elements.length ; i ++)
{
var e = document.forms.elements[i];
if(e.name == 'selAnnounce')
{
if ( e.checked == true)
{
a = e.value;
del = del + a + ";";
}
};
}
if(del == "")
{
alert("请选择要删除的日志")
}
else
{
if(confirm("确定要删除吗?")==true)
{
document.forms.submit();
}
}
}
//-->
</SCRIPT>
</head>
<%
const MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim idlist
dim title
title=request("txtitle")
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
if not isempty(request("selAnnounce")) then
idlist=request("selAnnounce")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
dim id
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(ID)
next
else
call deleteannounce(clng(ID))
end if
end if
dim sql
%>
<p> </p>
<p> </p>
<p> </p>
<table border="0" width="600" cellspacing="0" cellpadding="0" align="center">
<tr><td width="600" align="center">
<form method=Post action="delete.asp" name=forms>
<table width="600" border="0" cellpadding="2" cellspacing="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#1BA3D6">
<tr bgcolor="#2F6A8E">
<td align="center"><font color=#ffffff>ID</font></td>
<td align="center"><font color="#ffffff">名称</font></td>
<td align="center"><font color=#ffffff>格式</font></td>
<td align="center"><font color=#ffffff>日期</font></td>
<td height="25" align="center" bgcolor="#2F6A8E"><input name=chkall onClick=CheckAll(document.forms.chkall.checked) type=checkbox value=on><font color="#FFFFFF">全 选/</font> <a href="javascript:OnDelete()"><font color="#FFFFFF">删 除</font></a>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="622" height="20" colspan="5" align="center">
<% Set conn = Server.Createobject("ADODB.Connection")
conn.open MM_web_STRING
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from yy "
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.write "<p align='center'> 没有日志 </p>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showpage totalput,MaxPerPage,"delete.asp"
showContent
showpage totalput,MaxPerPage,"delete.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"delete.asp"
showContent
showpage totalput,MaxPerPage,"delete.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"delete.asp"
showContent
showpage totalput,MaxPerPage,"delete.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
</td>
</tr>
<%do while not rs.eof%>
<tr bgcolor="#FFFFFF">
<td>
<p align="center"><%=rs("编号")%>
</td>
<td>
<p align=center><%=rs("名称")%></p>
</td>
<td>
<p align="center"><strong><font color="#FF3333"><%=rs("格式")%></font></strong></td>
<td>
<p align=center> </p>
</td>
<td>
<p align="center">
<input type='checkbox' name='selAnnounce' value=''>
</td>
</tr> <%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<tr bgcolor="#FFFFFF" align="center">
<td width="600" height="11" colspan="5">
<DIV align="center">
<CENTER>
<p></p>
</CENTER>
</DIV>
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<p align='center'> "
if CurrentPage<2 then
response.write "首页 上一页</font> "
else
response.write "<a href="&filename&"?page=1&pl="&request("pl")&" class=""a1"">首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&pl="&request("pl")&" class=""a1"">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&pl="&request("pl")&" class=""a1"">"
response.write "下一页</a> <a href="&filename&"?page="&n&"&pl="&request("pl")&" class=""a1"">尾页</a>"
end if
response.write " 页次:</font><strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页</font> "
response.write " 共<b>"&totalnumber&"</b>条 <b>"&maxperpage&"</b>条/页</font> "
end function
sub deleteannounce(ID)
dim sql,deletefile
sql="delete from yy where ID="&cint(ID)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
end if
End sub
%>
</td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
<%rs.close
set rs=nothing
conn.close
set conn=nothing %>
</body>
</html>
[此贴子已经被yms123于2007-10-24 20:01:46编辑过]