求救,rs sql 出错了

doveph 2004-04-01 01:21:33
几个ASP嵌入到另一网站程序后,ASP中所有的 rs.open sql,conn,1,1都必须改成conn.execute (sql)的形式才不会出错"

Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

/iisHelp/common/500-100.asp,行242

ADODB.Recordset 错误 '800a0bb9'

变量或者类型不正确,或者不在可以接受的范围之内,要不就是与其他数据冲突。

/honglong/down.asp,行56
"
,有何解决办法??如果改,下面的都得怎么改呀?

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>程式下载页:</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<link rel="stylesheet" type="text/css" href="images/font.css">
</head>
<%
const MaxPerPage=10
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim filetype1
filetype1="软件下载"
dim filetype

filetype=request.Querystring("filetype")
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if

%>

<body>
<div align="center"><center>

<table border="0" cellspacing="1" width="95%">
<tr>
<td><a href="LOGIN.ASP" onclick="window.open(this.href,'','scrollbars=yes,width=500,height=400');return false;" title="站长专用,生人勿近">管理入口→非请莫入!</a>  >> 当前位置 > <a href="../index.htm" target="_top">首页</a> >
程式下载</td>
</tr>
</table>
</center></div><div align="center"><center>

<table border="0" cellspacing="1" width="95%" bgcolor="#F7FBFF">
<tr>
<td width="100%" bgcolor="#ACD6FF" height="20"><p align="center"><font color="#000000"><strong>程式下载
列表</strong></font></td>
</tr>
<tr>
<td width="100%" align="center"><a target="_self" href="down.asp"> 全部软件</a>|<a target="_self" href="down.asp?filetype=安全防御">安全防御</a>|<a target="_self" href="down.asp?filetype=聊天工具">聊天工具</a>|<a target="_self" href="down.asp?filetype=木马冰河">木马冰河</a>|<a target="_self" href="down.asp?filetype=扫描工具">扫描工具</a>|<a target="_self" href="down.asp?filetype=密码破解">密码破解</a>|<a target="_self" href="down.asp?filetype=邮箱工具">邮箱工具</a>|<a target="_self" href="down.asp?filetype=炸弹攻击">炸弹攻击</a>|<a target="_self" href="down.asp?filetype=QQ工具">QQ工具</a>|<a target="_self" href="down.asp?filetype=其他软件">其他软件</a>
</td>
</tr>
<tr>
<td width="100%"><br>
<%
dim sql
dim rs
sql="select * from download order by id desc"
Set rs= Server.CreateObject("ADODB.Recordset")
if filetype="" then
rs.open sql,conn,1,1
end if
if filetype="安全防御" then
rs.open "select * from download where filetype='安全防御' order by id desc",conn,1,1
end if
if filetype="聊天工具" then
rs.open "select * from download where filetype='聊天工具' order by id desc",conn,1,1
end if
if filetype="木马冰河" then
rs.open "select * from download where filetype='木马冰河' order by id desc",conn,1,1
end if
if filetype="扫描工具" then
rs.open "select * from download where filetype='扫描工具' order by id desc",conn,1,1
end if
if filetype="密码破解" then
rs.open "select * from download where filetype='密码破解' order by id desc",conn,1,1
end if
if filetype="邮箱工具" then
rs.open "select * from download where filetype='邮箱工具' order by id desc",conn,1,1
end if
if filetype="炸弹攻击" then
rs.open "select * from download where filetype='炸弹攻击' order by id desc",conn,1,1
end if
if filetype="QQ工具" then
rs.open "select * from download where filetype='QQ工具' order by id desc",conn,1,1
end if
if filetype="其他软件" then
rs.open "select * from download where filetype='其他软件' order by id desc",conn,1,1
end if
if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 程 序</p>"
else
totalPut=rs.recordcount
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,"down.asp"
showContent
showpage totalput,MaxPerPage,"down.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"down.asp"
showContent
showpage totalput,MaxPerPage,"down.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"down.asp"
showContent
showpage totalput,MaxPerPage,"down.asp"
end if
end if
rs.close
end if

set rs=nothing
conn.close
set conn=nothing


sub showContent
dim i
i=0

%> <div align="center"><center><table border="1" cellspacing="0" width="90%"
bgcolor="#F0F8FF" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF">
<tr>
<td width="7%" align="center" bgcolor="#0080C0" height="20"><font color="#FFFFFF"><strong>ID号</strong></font></td>
<td width="21%" align="center" bgcolor="#0080C0"><strong><font color="#FFFFFF">程式名称</font></strong></td>
<td width="65%" align="center" bgcolor="#0080C0"><font color="#FFFFFF"><strong>程式简介</strong></font></td>
<td width="7%" align="center" bgcolor="#0080C0"><font color="#FFFFFF"><strong>点击</strong></font></td>
</tr>
<%do while not rs.eof%>
<tr>
<td height="23"><p align="center"><%=rs("id")%></td>
<td><a target="_blank" href="openfile.asp?id=<%=rs("id")%>&filename=<%=rs("filename")%>"><%=rs("showname")%></a></td>
<td><%=rs("note")%>
</td>
<td><p align="center"><%=rs("hits")%></td>
</tr>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>
</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 "<form method=Post action="&filename&">"
response.write "<p align='center'>>>分页 "
if CurrentPage<2 then
response.write "<font color='999966'>首页 上一页</font> "
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="¤tPage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write "<font color='999966'>下一页 尾页</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)
response.write ">下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"¤tPage&"</font>/"&n&"</strong>页 "
response.write " 共<b>"&totalnumber&"</b>个程式 <b>"&maxperpage&"</b>个程式/页 "
response.write " 转到:<input type='text' name='page' size=4 maxlength=10 class=smallInput value="¤tpage&">"
response.write "<input class=buttonface type='submit' value=' Goto ' name='cndok'></span></p></form>"

end function


%>
<p> </td>
</tr>
</table>
</center>
<CENTER>
</CENTER>
</div>
</body>
</html>
...全文
17 点赞 收藏 8
写回复
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
qzriso 2004-04-01
这么多if---end if,建议用select case----end select
回复
qzriso 2004-04-01
filetype的值是什么?
filetype=trim(request.Querystring("filetype"))
输出:response.write filetype 看一下
回复
pizixt 2004-04-01
rs.open "select * from download where filetype='"&filetype&"' order by id desc",conn,1,1
回复
QQgenie 2004-04-01
思路不太清晰,有点乱
1.象"安全防御"等都可以放在一个分类表中(用菜单方式的表),取得时候也容易,以后增加时也不要再改程序.
2.能合并的就不要写太多,IF ....... 用一个变量sql,如:
if filetype<>"" then
sql = "select * from download where filetype='"
sql = sql & filetype & "'"
sql = sql & " order by id desc"


...
end if
回复
doveph 2004-04-01
具体怎么改???
回复
jiffer 2004-04-01
给每一个都加上rs.close
或者改用变量。只要一个sql语句就行了。
回复
pizixt 2004-04-01
注意rs.close
回复
潜水的鱼 2004-04-01
看了代码就头晕


闪人~
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

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