| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 447 人关注过本帖
标题:这是代码,请问错哪了,显示
只看楼主 加入收藏
uj8yh
Rank: 1
等 级:新手上路
帖 子:35
专家分:0
注 册:2007-8-20
结帖率:100%
收藏
 问题点数:0 回复次数:6 
这是代码,请问错哪了,显示

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>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</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>&nbsp;</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'>&nbsp;"
if CurrentPage<2 then
response.write "首页 上一页</font>&nbsp;"
else
response.write "<a href="&filename&"?page=1&pl="&request("pl")&" class=""a1"">首页</a>&nbsp;"
response.write "<a href="&filename&"?page="&CurrentPage-1&"&pl="&request("pl")&" class=""a1"">上一页</a>&nbsp;"
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 "&nbsp;页次:</font><strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页</font> "
response.write "&nbsp;共<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编辑过]

搜索更多相关主题的帖子: 代码 
2007-10-24 19:57
uj8yh
Rank: 1
等 级:新手上路
帖 子:35
专家分:0
注 册:2007-8-20
收藏
得分:0 
晕,,哦.
杂这样显示啊!
2007-10-24 19:58
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
<!--#include file="../Connections/web.asp" -->
楼主在哪里写了连接数据库的代码?
还有就是发代码前,去掉@Language 标志这样就不会改变格式了。
2007-10-24 20:05
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 

错误提示很明显
没有定义conn

2007-10-24 21:01
e4lich
Rank: 2
等 级:新手上路
威 望:4
帖 子:182
专家分:0
注 册:2006-10-26
收藏
得分:0 
请把277那行变为红色吧,这样很难看

我只想变强!     
2007-10-24 21:01
不惑
Rank: 2
等 级:论坛游民
威 望:2
帖 子:569
专家分:13
注 册:2007-3-22
收藏
得分:0 
那就。那一行是217啊?难不能我帮你看程序还得去数第几行
2007-10-24 21:11
hmhz
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:30
帖 子:1890
专家分:503
注 册:2006-12-17
收藏
得分:0 
呵呵

[编程论坛] ASP超级群:49158383  敲门暗号:ASP编程
龍艺博客 http://www.
2007-10-24 23:14
快速回复:这是代码,请问错哪了,显示
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.046656 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved