标题:Microsoft VBScript 运行时错误 (0x800A000D) 类型不匹配: 'rs'
只看楼主
fengmnll
Rank: 1
等 级:新手上路
帖 子:79
专家分:3
注 册:2008-11-6
结帖率:85.71%
已结贴  问题点数:5 回复次数:3 
Microsoft VBScript 运行时错误 (0x800A000D) 类型不匹配: 'rs'
<!--#include file="conn.asp"-->
<html>
<head>
<link href="css.css" type=text/css rel=stylesheet>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<script type="text/javascript" src="include/admin.js"></script>
<title>管理新闻</title>
</head>
<body >
<table width="45%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#000000" class="border">
        <tr class="title">
          <td bgcolor="#A4B6D7" height="12">&nbsp;</td>
        </tr>
        <tr class="title">
          <td bgcolor="#A4B6D7" height="90"><table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#000000">
            <tr>
              <td width="21%" height="25" align="center" bgcolor="#cccccc">课程号</td>
              <td width="44%" align="center" bgcolor="#cccccc">课程信息&nbsp;</td>
              <td width="35%" align="center" bgcolor="#cccccc">操作</td>
            </tr>
            <%
   set rs=server.CreateObject("ADODB.Recordset")
                  rs.open "select class_id,class_name from class",conn,1,1
if rs.eof or rs.bof then

response.write ("暂无记录!!")

else

'实现分页功能

  rs.pagesize=5

  page=clng(request("page"))

  if page<1 then page=1

  rs.absolutepage=page

  for i=1 to rs.pagesize
  %>
            <tr bgcolor="#ffffff">
              <td height="22" align="center"><%=rs("class_id")%></td>
              <td align="center"><%=rs("class_name")%></td>
              <td align="center">               
                  <a href="modify_class.asp?id=<%=rs("class_id")%>">修改</a>//修改传参处
                  <a href="javascript:DoEmpty('del_class.asp?class_id=<%=rs("class_id")%>');">删除</a>              </td>
            </tr>
          <%

rs.movenext

if rs.eof then exit for

next

end if

%>

          </table>
         
            &nbsp;<% if page<>1 then %>

<a href=<%=path%>?page=1&page1=<%=clng(page1)%>> 第一页</a>

<a href=<%=path%>?page=<%=(page-1)%>&page1=<%=clng(page1)%>> 上一页</a>

<%end if

if page<>rs.pagecount then %>

<a href=<%=path%>?page=<%=(page+1)%>&page1=<%=clng(page1)%>>下一页</a>

<a href=<%=path%>?page=<%=rs.pagecount%>&page1=<%=clng(page1)%>>最后一页</a>

<%end if %></td>
        </tr>
        
</table>
<br>
</body>
</html>
modify_calss.asp

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>添加课程信息</title>
<script language="JavaScript" type="text/javascript" src="../js/function.js"></script>

<script language="javascript">
function check()
{
            if  (document.myform.class_name.value == "")
                  {window.alert('请输入课外活动名称!!');
                  document.myform.class_name.focus();
                   return  false;}
                 return true
       }
</script>

</head>

<body>
<table width="45%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30" colspan="2"><div align="center"><strong>修改课程信息</strong></div></td>
  </tr>
<form action="save1.asp" method="post" name="myform" onsubmit="return check()">
  <tr>
    <td width="16%" height="30"><div align="center">课程名称:</div></td>
    <td width="84%" height="30"><input name="class_name" type="text" value="<%=rs("class_name")%>"></td>//错误的地方
  </tr>
  <tr>
    <td height="30" colspan="2"><div align="center">
      <input type="submit" name="Submit" value="提交">
      <input type="reset" name="Submit2" value="重置">
    </div>
    </td>
  </tr>
  </form>
</table>
</body>
</html>
Microsoft VBScript 运行时错误 (0x800A000D)
类型不匹配: 'rs'
不知道为什么出错了? 谢谢

搜索更多相关主题的帖子: Microsoft VBScript 类型 运行 
2010-05-20 10:15
fengmnll
Rank: 1
等 级:新手上路
帖 子:79
专家分:3
注 册:2008-11-6
得分:0 
save_class.asp
<!--#include file="conn.asp" -->
<%
      dim  sql,class_name
      class_name=Trim(Request.Form("class_name"))
      set rs=Server.CreateObject("ADODB.Recordset")
      sql="select * from class where class_name='"&class_name&"'"
      rs.open sql,conn,1,3
      if not rs.eof  then
             response.Write"<script> alert('此学生已存在.');history.back(edit_class.asp);</script>"
             response.Redirect("edit_class.asp")
             response.End
     else
            rs.addnew
            rs("class_name")=class_name
            rs.update
            rs.close
            set rs=nothing
  end if
    response.write "<script language=jscript>alert(记录添加成功!');history.back(edit_class.asp)</script>"
     response.Redirect("edit_class.asp")
     response.End()  
%>
2010-05-20 10:17
魏兴耀
Rank: 8Rank: 8
来 自:江西
等 级:蝙蝠侠
威 望:3
帖 子:246
专家分:840
注 册:2009-11-9
得分:3 
稍微有点繁琐了,你先说说要到底要做的是什么,rs出了问题,你要把数据库的图贴一下,不然真不好判断

只有大胆尝试,才有机会得到想要的成功
2010-05-20 10:38
fengmnll
Rank: 1
等 级:新手上路
帖 子:79
专家分:3
注 册:2008-11-6
得分:0 
edit_class.asp
 <a href="modify_class.asp?id=<%=rs("class_id")%>">修改</a>//修改传参处
modify_class.asp
 <td width="16%" height="30"><div align="center">课程名称:</div></td>
  <td width="84%" height="30"><input name="class_name" type="text" value="<%=rs("class_name")%>"></td>//错误的地方

save_class.asp
<!--#include file="conn.asp" -->
<%
      dim  sql,class_name
      class_name=Trim(Request.Form("class_name"))
      set rs=Server.CreateObject("ADODB.Recordset")
      sql="select * from class where class_name='"&class_name&"'"
      rs.open sql,conn,1,3
      if not rs.eof  then
             response.Write"<script> alert('此学生已存在.');history.back(edit_class.asp);</script>"
             response.Redirect("edit_class.asp")
             response.End
     else
            rs.addnew
            rs("class_name")=class_name
            rs.update
            rs.close
            set rs=nothing
  end if
    response.write "<script language=jscript>alert(记录添加成功!');history.back(edit_class.asp)</script>"
     response.Redirect("edit_class.asp")
     response.End()  
%>

Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'class_id=' 中。不知道怎么修改呢?
2010-05-20 11:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-307426-1-1.html




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

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