asp中类型不匹配的一个错误

kawensong 2009-09-11 09:53:50
请大家帮忙看下,尤其是刚刚那个高手hookee ,谢谢了

错误提示:

Microsoft VBScript 运行时错误 (0x800A000D)
类型不匹配: 'rst'
/liehuo_good/system/productdo.asp, 第 73 行



<!--#include file="fun.asp"-->
<%
Sub main()
id=request("id")
if request("act")="add" then
call add_del_update("product","insert","")
response.write "<script language=javascript>alert('添加成功!');history.go(-1);self.location=document.referrer;</script>"
end If
if request("act")="edit" Then
call add_del_update("product","update",id)
response.write "<script language=javascript>alert('修改成功!');history.go(-1);self.location=document.referrer;</script>"
end If
if request("act")="del" then
call add_del_update("product","delete",id)
response.write "<script language=javascript>alert('删除成功!');history.go(-1);self.location=document.referrer;</script>"
end If
%>
<%
if request("do")="edit" Then
id=request.querystring("id")
set rst=server.createobject("adodb.recordset")
sql="select * from product where id="&id
rst.open sql,conn,1,1
end If
%>
<div class="maintitle">公司产品<%if request("do")="edit" Then%>修改<%Else%>添加<%end if%></div>
<table border="1" cellpadding="5" cellspacing="0" class="wmain tabcolor">
<form method="post" name="myform" <%if request("do")="edit" Then%>action="?act=edit&id=<%=rst("id")%>"<%Else%>action="?act=add"<%end If%> onsubmit="return CheckForm(this)">
<tr><td><span class="maintit">标题:</span><input name="title" type="text" size="50" <%if request("do")="edit" Then%>value="<%=rst("title")%>"<%end If%> check="^\S+$" warning="栏目不能为空,且不能含有空格"></td></tr>
<tr><td><span class="maintit">日期:</span><input name="riqi" type="text" size="10" <%if request("do")="edit" Then%>value="<%=rst("riqi")%>"<%else%>value="<%=now()%>"<%end if%> check="^\d{4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{2}:\d{2}$" warning="日期格式2004-8-10 12:34:54"></td></tr>
<tr><td><span class="maintit">类别:</span>
<%if request("do")="edit" Then%>
<select name="cid">
<%
set rs1=server.createobject("adodb.recordset")
sql = "select * from productclass where big=0"
rs1.open sql,conn,1,1
if rs1.eof and rs1.bof then
response.write "请先添加类别"
else
%>
<%do while not rs1.eof%>
<optgroup <% if rs1("id")=rst("cid") then response.Write("selected") end if%> label="<%=rs1("title")%>"></optgroup>
<%
set rs2=server.createobject("adodb.recordset")
sql = "select * from productclass where big="& rs1("id") &""
rs2.open sql,conn,1,1
if rs2.eof and rs2.bof then
response.write "请先添加类别"
else
%>
<%do while not rs2.eof%>
<option <% if rs2("id")=rst("cid") then response.Write("selected") end if%> value="<%=rs2("id")%>">  <%=rs2("title")%></option>
<%
rs2.movenext
Loop
end If
rs2.close
Set rs2=Nothing
%>
<%
rs1.movenext
Loop
end If
rs1.close
Set rs1=Nothing
%>
</select>
<%else%>
<%=request.querystring("title")%><input name="cid" type="hidden" value="<%=request.querystring("id")%>">
<%end if%></td></tr>
<tr><td><span class="maintit">图片:</span><input name="photo" type="text" maxlength="50" size="25" <%if request("do")="edit" Then%>value="<%=rst("photo")%>"<%else%>value="nopic.jpg"<%end if%>> <iframe src="Form_UpFiles.asp" frameborder=0 scrolling=no width="300" height="22"></iframe></td></tr>
<tr><td><span class="maintit">推荐:</span><input name="tuijian" type="radio" id="tuijian" value="true" <% If request("do")="edit" and rst("tuijian")=true then response.Write("checked") end if%>>是   <input name="tuijian" type="radio" id="tuijian" value="false" <% if request("do")="edit" And rst("tuijian")=false then response.Write("checked") end if%>>否</td></tr>
<tr><td><span class="maintit">内容:</span><br><input type="hidden" name="content" <%if request("do")="edit" Then%>value="<%=Server.HTMLEncode(rst("content"))%>"<%end If%>>
<IFRAME ID="eWebEditor" src="../eWebEditor/ewebeditor.asp?id=content&style=standard" frameborder="0" scrolling="no" width="548" height="350"></IFRAME></td></tr>
<tr><td><input type="submit" value="提交"></td></tr>
</table>
</form>
<%
if request("do")="edit" Then
rst.close
Set rst=Nothing
end If
End Sub
%>
<!--#include file="system.asp"-->


...全文
108 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
凡夫与俗子 2009-09-11
  • 打赏
  • 举报
回复
73行是哪一行啊。。。。。
hookee 2009-09-11
  • 打赏
  • 举报
回复
试试看

<!--#include file="fun.asp"-->
<%
Sub main()
id=request("id")
if request("act")="add" then
call add_del_update("product","insert","")
response.write "<script language=javascript>alert('添加成功!');history.go(-1);self.location=document.referrer;</script>"
end If
if request("act")="edit" Then
call add_del_update("product","update",id)
response.write "<script language=javascript>alert('修改成功!');history.go(-1);self.location=document.referrer;</script>"
end If
if request("act")="del" then
call add_del_update("product","delete",id)
response.write "<script language=javascript>alert('删除成功!');history.go(-1);self.location=document.referrer;</script>"
end If
%>
<%
if request("do")="edit" Then
id=request.querystring("id")
set rst=server.createobject("adodb.recordset")
sql="select * from product where id="&id
rst.open sql,conn,1,1
end If
%>
<div class="maintitle">公司产品<%if request("do")="edit" Then%>修改<%Else%>添加<%end if%></div>
<table border="1" cellpadding="5" cellspacing="0" class="wmain tabcolor">
<form method="post" name="myform" <%if request("do")="edit" Then%>action="?act=edit&id=<%=rst("id")%>"<%Else%>action="?act=add"<%end If%> onsubmit="return CheckForm(this)">
<tr><td><span class="maintit">标题:</span><input name="title" type="text" size="50" <%if request("do")="edit" Then%>value="<%=rst("title")%>"<%end If%> check="^\S+$" warning="栏目不能为空,且不能含有空格"></td></tr>
<tr><td><span class="maintit">日期:</span><input name="riqi" type="text" size="10" <%if request("do")="edit" Then%>value="<%=rst("riqi")%>"<%else%>value="<%=now()%>"<%end if%> check="^\d{4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{2}:\d{2}$" warning="日期格式2004-8-10 12:34:54"></td></tr>
<tr><td><span class="maintit">类别:</span>
<%if request("do")="edit" Then%>
<select name="cid">
<%
set rs1=server.createobject("adodb.recordset")
sql = "select * from productclass where big=0"
rs1.open sql,conn,1,1
if rs1.eof and rs1.bof then
response.write "请先添加类别"
else
%>
<%do while not rs1.eof%>
<optgroup <% if rs1("id")=rst("cid") then response.Write("selected") end if%> label="<%=rs1("title")%>"></optgroup>
<%
set rs2=server.createobject("adodb.recordset")
sql = "select * from productclass where big="& rs1("id") &""
rs2.open sql,conn,1,1
if rs2.eof and rs2.bof then
response.write "请先添加类别"
else
%>
<%do while not rs2.eof%>
<option <% if rs2("id")=rst("cid") then response.Write("selected") end if%> value="<%=rs2("id")%>">  <%=rs2("title")%></option>
<%
rs2.movenext
Loop
end If
rs2.close
Set rs2=Nothing
%>
<%
rs1.movenext
Loop
end If
rs1.close
Set rs1=Nothing
%>
</select>
<%else%>
<%=request.querystring("title")%><input name="cid" type="hidden" value="<%=request.querystring("id")%>">
<%end if%></td></tr>
<tr><td><span class="maintit">图片:</span><input name="photo" type="text" maxlength="50" size="25" <%if request("do")="edit" Then%>value="<%=rst("photo")%>"<%else%>value="nopic.jpg"<%end if%>> <iframe src="Form_UpFiles.asp" frameborder=0 scrolling=no width="300" height="22"></iframe></td></tr>
<tr><td><span class="maintit">推荐:</span><input name="tuijian" type="radio" id="tuijian" value="true" <% If request("do")="edit" and Not IsNull(rst("tuijian").value) and CBool(rst("tuijian").value)=true then response.Write("checked") end if%>>是   <input name="tuijian" type="radio" id="tuijian" value="false" <% if request("do")="edit" And Not IsNull(rst("tuijian").value) and CBool(rst("tuijian").value)=false then response.Write("checked") end if%>>否</td></tr>
<tr><td><span class="maintit">内容:</span><br><input type="hidden" name="content" <%if request("do")="edit" Then%>value="<%=Server.HTMLEncode(rst("content"))%>"<%end If%>>
<IFRAME ID="eWebEditor" src="../eWebEditor/ewebeditor.asp?id=content&style=standard" frameborder="0" scrolling="no" width="548" height="350"></IFRAME></td></tr>
<tr><td><input type="submit" value="提交"></td></tr>
</table>
</form>
<%
if request("do")="edit" Then
rst.close
Set rst=Nothing
end If
End Sub
%>
<!--#include file="system.asp"-->

kawensong 2009-09-11
  • 打赏
  • 举报
回复
顶下.
jackzhangyunjie 2009-09-11
  • 打赏
  • 举报
回复
rst("tuijian")=false
你看看你的返回类型是什么,如果是布尔值,从数据库读取出来的也是0或1
shenymce 2009-09-11
  • 打赏
  • 举报
回复
把错误行标出来,别个好理解了
黑心 2009-09-11
  • 打赏
  • 举报
回复
估计rst("cid")没有取到值。
改成这样试下。

<%
if request("do")="edit" Then
id=request.querystring("id")
set rst=server.createobject("adodb.recordset")
sql="select * from product where id="&id
rst.open sql,conn,1,1
if rst.recordcount>0 then
rst_1=rst("cid")
else
rst_1=""
end if
end If
%>
……
……
……
……

<%do while not rs1.eof%>
<optgroup <% if rs1("id")=rst_1 then response.Write("selected") end if%> label="<%=rs1("title")%>"></optgroup>
<%
set rs2=server.createobject("adodb.recordset")
sql = "select * from productclass where big="& rs1("id") &""
rs2.open sql,conn,1,1
if rs2.eof and rs2.bof then
response.write "请先添加类别"
else
%>
<%do while not rs2.eof%>
<option <% if rs2("id")=rst_1 then response.Write("selected") end if%> value="<%=rs2("id")%>">  <%=rs2("title")%></option>
<%
rs2.movenext
Loop
end If
rs2.close
Set rs2=Nothing
%>

kawensong 2009-09-11
  • 打赏
  • 举报
回复
hookee--方便么,给我你的QQ或者什么的
或者你的邮箱?我把网站模板发给你 你改下,可能光看那个单页面不好改
kawensong 2009-09-11
  • 打赏
  • 举报
回复
hookee--- 我试了你改的 还是那个错误啊

怎么回事呢

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧