Microsoft VBScript 运行时错误 错误 '800a01f4' 怎么解决?

w43869121 2010-08-03 12:32:46
Microsoft VBScript 运行时错误 错误 '800a01f4'
变量未定义: 'idlist'
/Admin/UCCDK/cdkey.asp,行 32

能打开只要不执行删除就不出现错误如图

<!-- #Include File="../Include/Admin_Onlogin.asp" -->
<link href="5wuc.css" rel="stylesheet" type="text/css">
<%
if not isempty(request("del")) then
if request("del")="all" then
if request("type")="" or isnull(request("type")) then
sql="select * from Game_cdkey where game_id='"&request("game_id")&"'"
Set rs = YSvoid.Exec(sql,1)
else
sql="select * from Game_cdkey where game_id='"&request("game_id")&"' and type="&request("type")
Set rs = YSvoid.Exec(sql,1)
end if
do while not rs.eof
rs.delete
rs.movenext
loop
end if
end if

dim totalPut,game_id,type1
dim CurrentPage
dim TotalPages,maxperpage
maxperpage=30
dim k
k=1
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)
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(id)
next
else
call deleteannounce(clng(idlist))
end if
end if
game_id=request("game_id")
type1=request("type")

if type1<>"" and not isnull(type1) then
sql="select * from Game_cdkey where game_id='"&game_id&"' and type="&type1&" order by id desc"
else
sql="select * from Game_cdkey where game_id='"&game_id&"'order by id desc"
end if
Set rs = YSvoid.Exec(sql,1)

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
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,"cdkey.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,"cdkey.asp"
else
currentPage=1
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,"cdkey.asp"
end if
end if
rs.close

set rs=nothing
sub showContent (totalput,MaxPerPage)
%>

<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" >
<form action="cdkey.asp" method="post" name="F">
<input type="hidden" name="game_id" value="<%=game_id%>">
<input type="hidden" name="type" value="<%=type1%>">
<!--DWLayoutTable-->
<tr bgcolor="#1266AE">
<td height="25" colspan="3" valign="middle"><a href="addcdkey.asp?game_id=<%=game_id%>&type=<%=type1%>" target="right"><font color="#FFFFFF"><b>添加CDKEY</b></font></a> | <a href="add_more_cdkey.asp?game_id=<%=game_id%>&type=<%=type1%>" target="right"><font color="#FFFFFF"><b>批量添加CDKEY</b></font></a> | <a href="#" onClick="{if(confirm('确认要全部删除吗?')){location.href='cdkey.asp?del=all&game_id=<%=game_id%>&type=<%=type1%>';}return false;}"><font color="#FFFFFF"><b>删除全部CDKEY</b></font></a></td>
</tr>
<tr>
<td width="31" height="23" align="center" valign="middle">编号</td>
<td width="636" align="center" valign="middle">CDKEY</td>
<td width="60" align="center" valign="middle"><input type='submit' value='删除'></td>
</tr>
<%
do while not rs.eof
%>
<tr>
<td height="25" align="center" valign="middle"><%=rs("id")%></td>
<td align="center" valign="middle"><%=rs("cdkey")%></td>
<td align="center" valign="middle"><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("id"))%>'></td>
</tr>
<%k=k+1
if k>=maxperpage then exit do
rs.movenext
loop
%>
</form>
</table>

<%
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
if CurrentPage<2 then
response.write "<table border=1 width=100% cellspacing=0 cellpadding=0 bordercolor=#0033FF>"
response.write "<tr height=30>"
response.write "<td align=left>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>页 第<font color=#ff6600><b>"¤tPage&"</b></font>页 共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条相关信息</td>"
response.write "<td align=right>"
response.write "【最前页】【上一页】"
else
response.write "<table border=0 width=100% cellspacing=0 cellpadding=0>"
response.write "<tr height=30>"
response.write "<td align=left>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>页 第<font color=#ff6600><b>"¤tPage&"</b></font>页 共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条相关信息</td>"
response.write "<td align=right>"
response.write "【<a href="&filename&"?page=1&game_id="&game_id&"&txtitle="&request("txtitle")&">最前页</a>】"
response.write "【<a href="&filename&"?page="¤tPage-1&"&game_id="&game_id&"&txtitle="&request("txtitle")&">上一页</a>】 "
end if
if n-currentpage<1 then
response.write "【下一页】【最后页】"
else
response.write "【<a href="&filename&"?page="&(CurrentPage+1)&"&game_id="&game_id&"&txtitle="&request("txtitle")&">"
response.write "下一页</a>】【<a href="&filename&"?page="&n&"&game_id="&game_id&"&txtitle="&request("txtitle")&">最后页</a>】"
end if
response.write "</td>"
response.write "</tr>"
response.write "</table>"
response.write "</form>"
end function
sub deleteannounce(id)
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="delete from Game_cdkey where id="&cstr(id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
end if
End sub
%>
</body>
</html>

...全文
2746 点赞 收藏 10
写回复
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
hai_men 2010-08-03
dim totalPut,game_id,type1
dim CurrentPage
dim TotalPages,maxperpage

后面+上
dim idlist
回复
hai_men 2010-08-03
变量未定义: 'idlist'

加上
dim idlist 试试
回复
w43869121 2010-08-03
我崩溃啊!!!求解决
回复
w43869121 2010-08-03
[Quote=引用 7 楼 zqqazhn 的回复:]
引用 5 楼 chinmo 的回复:
哎,还是建议你先把基础看看吧,掌握了再弄吧
全是最基本的错误

正解.数据库连接文件错误
[/Quote]
那怎么办啊?我不懂asp的?
回复
哎,还是建议你先把基础看看吧,掌握了再弄吧
全是最基本的错误
回复
sy_binbin 2010-08-03
检查数据库链接文件是否引入

把数据库链接文件中的Option Explicit
这段代码去掉试试

或者
dim conn
回复
zqqazhn 2010-08-03
[Quote=引用 5 楼 chinmo 的回复:]
哎,还是建议你先把基础看看吧,掌握了再弄吧
全是最基本的错误
[/Quote]
正解.数据库连接文件错误
回复
hanlongppl 2010-08-03
[Quote=引用 5 楼 chinmo 的回复:]
哎,还是建议你先把基础看看吧,掌握了再弄吧
全是最基本的错误
[/Quote]


这些都是最基本的 不要只顾着写东西看成果
回复
w43869121 2010-08-03
[Quote=引用 2 楼 hai_men 的回复:]
dim totalPut,game_id,type1
dim CurrentPage
dim TotalPages,maxperpage

后面+上
dim idlist
[/Quote]
又变成
Microsoft VBScript 运行时错误 '800a01a8'

缺少对象: 'Conn'

\Admin\UCCDK\cdkey.asp, line 157
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

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