| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1376 人关注过本帖
标题:编程就像生活一样!总是需要一些经验,别人的建议亦不可缺少!!
只看楼主 加入收藏
袜子
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2008-4-30
收藏
 问题点数:0 回复次数:12 
编程就像生活一样!总是需要一些经验,别人的建议亦不可缺少!!
<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->


<script Language="vbscript">
sub check()
    c=document.form1.page.value
            if c<>"" then
                if not IsNumeric(c) then
                msgbox " 页数只能输入数字"
                document.form1.page.select()
                exit sub
                else
                
                end if
            else
                msgbox"请输入想要转到页数"
                document.form1.page.select()
                exit sub
            end if
            
                document.form1.submit()
end sub
</script>

 <%flag1=0
 flag2=0
 reportid=trim(request("reportid"))

        set rs=Server.CreateObject("ADODB.Recordset")
        sqls="select  * from examination  "
        set rss=conn.execute(sqls)
    if rss.eof then
        titles="暂无成绩信息"
        flag1=1
    else
        
        if reportid="" then
        reportid=rss("examinationid")
        flag2=1
        else
        reportid=reportid
        end if
        set rs1=conn.execute("select * from examination where examinationid="&reportid&"")
        title="第 "&rs1("examinationid")&" 期考试统计"
        if flag2=1 then title=title&"<font color=red>(最新一期)</font>"
        set rs2=conn.execute("select * from test where examinationid="&rs1("examinationid")&"")
    titles=title&"<p>(判断题数"&rs2("rightorwrongid")&"题/"&rs2("rightorwrongscore")&"分,选择题数"&rs2("selectid")&"题/"&rs2("selectscore")&"分,填空题数"&rs2("fillingid")&"题/"&rs2("fillingscore")&"分)</p>"
        
        zf=rs2("rightorwrongid")*rs2("rightorwrongscore")+rs2("selectid")*rs2("selectscore")+rs2("fillingid")*rs2("fillingscore")

        
    
end if
        %>

<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网上考试系统</title>
<link rel="stylesheet" type="text/css" href="../css.css">
</head>

<body topmargin="0" leftmargin="0">
<p>
<p align="center"><font face="隶书" size="6" >成绩统计管理</font></p>
<div align="center">
  <center>
  <table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="500">
    <tr>
      <td align="center" colspan="4"> 往期统计:
      <select name="cate" size="1" style="background-color: #EFEFF7" onchange="javascript:self.location=this.options[this.selectedIndex].value">
     <%set rs3=conn.execute("select distinct examinationid from examination order by examinationid desc")
     while not rs3.eof %>
      <option  value="report.asp?reportid=<%=rs3("examinationid")%>" <%if cint(request("examinationid"))=cint(rs3("examinationid")) then response.write "selected"%>>第<%=rs3("examinationid")%>期</option>
<%rs3.movenext
wend%>           
 </select>&nbsp;&nbsp;&nbsp;<%=titles%>
       <form method="get" name=form2 action="">
  
    <%keyword=trim(request("keyword"))
    if keyword="" then
    keywords="所有考生"
    else
    keywords=keyword
    end if
    %>
      <p>以下为姓名为 <font color=red><%=keywords%></font> 的考生列表&nbsp; 输入考生姓名<input type="text" name="keyword" size="20"  class="line">&nbsp; <input type="submit" value="查找" name="B1" style="width: 60; height: 22; border-style: solid; border-width: 1px; background-color: #FFFFFF"></form></td>
    </tr>
      
    <tr>
      <td align="center" bgcolor="#000099"><font color="#FFFFFF">考生姓名</font></td>
      <td align="center" bgcolor="#000099"><font color="#FFFFFF">分数</font></td>
      <td align="center" bgcolor="#000099"><font color="#FFFFFF">补考设置</font></td>
      <td align="center" bgcolor="#000099"><font color="#FFFFFF">补考成绩</font></td>
    </tr>
  <%
  if flag1=1 then
  else
          sql="select student.*,examination.* from student,examination where  student.studentname like '%"&keyword&"%' and examination.studentnumber=student.studentnumber and examination.examinationid="&rs1("examinationid")&" order by student.studentnumber desc"
        
        rs.open sql,conn,3,1,1
            rs.pagesize=10

  
  
  if not (rs.eof and rs.bof) then
        Page = cint(Request.querystring("Page"))
           If Page < 1 Then Page = 1
           If Page > rs.PageCount Then Page = rs.PageCount
            showpages rs,Page
    %>
    <%else%>
<tr><td colspan=4><center><font color=red>暂无此学员信息</font></center></td></tr>
    <%end if%>
<%
Sub showpages( rs,Page )
   rs.AbsolutePage = Page        
        for i=0 to rs.pagesize-1
            j=j+1
            if j mod 2 =0 then
                bg="#EFEFF7"
            else
                bg="#ffffff"
            end if
            
            if rs("score")>=cint(zf*6/10) then
            fen="<font colot=#008000>"&rs("score")&"分</font>"
            bk="不需要"
            bfen="不需要"
            else
            fen="<font colot=red>"&rs("score")&"分</font>"
            bk="<a href=test_again.asp?studentnumber="&rs("studentnumber")&"&reportid="&reportid&">批准补考</a>"
            bfen="需要补考"
                if rs("pass")=True then
                bk="已批准补考"
                     if rs("makeup")=0 then
                    bfen="还未补考"
                    else
                        if rs("makeup")>=cint(zf*6/10) then
                        bfen="<font colot=#008000>"&rs("makeup")&"分</font>"
                        else
                        bfen="<font colot=red>"&rs("makeup")&"分</font>"
                        end if
                    end if
                end if
            end if             
            %>

    <tr bgcolor=<%=bg%>>
      <td align="center"><a href="student.asp?id=<%=rs("studentnumber")%>"><%=rs("studentname")%></a></td>
      <td align="center"> <%=fen%></td>
      <td align="center">
          <%=bk%></td>
      <td align="center">
          <%=bfen%></td>
    </tr>
    <%
        rs.movenext
          If rs.EOF Then Exit For
         Next%>
  <%End Sub
  
  end if %>  

    <tr>
      <td colspan="4" align="center">
     
     <form action=report.asp?keyword=<%=keyword%>&reportid=<%=reportid%> method="get" name=form1  >
          <%
        
        response.write rs.pagesize&"条一页&nbsp;&nbsp;"
        if Page=1 then
               response.write"第一页  "
           end if
           If Page <> 1 Then
              Response.Write "<A HREF=report.asp?keyword="&keyword&"&reportid="&reportid&"&Page=1>第一页</A>?"
               Response.Write "<A HREF=report.asp?keyword="&keyword&"&reportid="&reportid&"&Page=" & (Page-1) & ">上一页</A>?"
           End If
           If Page <> rs.PageCount Then
             Response.Write "<A HREF=report.asp?keyword="&keyword&"&reportid="&reportid&"&Page=" & (Page+1) & ">下一页</A>?"
               Response.Write "<A HREF=report.asp?keyword="&keyword&"&reportid="&reportid&"&Page=" & rs.PageCount & ">最后一页</A>?"
          End If
           if page= rs.PageCount then
              response.write"最后一页  "
          end if
        response.write "总共有"&rs.pagecount&"页,&nbsp;目前是第"&page&"页"
          'response.write page&"/"&rs.pagecount&"页</center>"
        
 %>
      转到<font class="a">
      <input maxLength="8" size="4" name="page" value=<%=page%>>
      <input type="hidden" value=<%=keyword%> name="keyword">
      <input type="hidden" value=<%=reportid%> name="reportid">

      页<span lang="en-us"> </span>
      <input class="buttonface" type="button" value=" Goto " onclick=check() style="width: 60; height: 22; border-style: solid; border-width: 1px; background-color: #FFFFFF"></font><br>
      </a>
      </form>

      

     
     
     </td>
    </tr>
    </table>
  </center>
</div>

</body>

</html>
看起来有些麻烦!解决这个问题恐怕需要热心的您具备一些东西,比如有sql sever 2000数据库和iis的支持!
  现在我来说明这个程序段的病症。就是在浏览执行的时候出现了这样的问题:
         无法显示网页
          试图访问的网页出现问题,无法显示。
          请尝试执行下列操作:
         单击刷新按钮,或稍后重试。
        打开 localhost 主页,然后查找与所需信息相关的链接。
        HTTP 错误 500.100 - 内部服务器错误 - ASP 错误
         Internet 信息服务
       技术信息(用于支持人员)
          错误类型:
      ADODB.Recordset (0x800A0E78)
      对象关闭时,不允许操作。
    /admin/report.asp, 第 183 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
请您务必帮我!!!
    这个问题是不是是 “Internet 信息服务”安装的时候出错了!
谢谢您
搜索更多相关主题的帖子: document sub 经验 
2008-05-11 12:53
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
下次发帖把出错信息放在前面。在183行标明一下,比如加粗。
2008-05-11 18:55
袜子
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2008-4-30
收藏
得分:0 
急急急!!怎么没有人帮我啊!
它已经困扰我一周了!我是真的不知道那里出错了!!好难!帮我@!!帮我!!!谢谢各位
2008-05-12 16:37
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
ADODB.Recordset (0x800A0E78)
      对象关闭时,不允许操作。
    /admin/report.asp, 第 183 行
这个错误表明在第183行之前
这个页面的rs对象执行了
rs.Close方法
而这个方法执行完毕后,除了清空对象外(Set rs=Nothing)是不能再对rs对象进行任何操作的。
2008-05-12 17:31
袜子
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2008-4-30
收藏
得分:0 
非常感谢!急急急!这个问题已经浪费我好多时间了!拜托了
可是正如您说的!我又看了编程序!里面没有发现有rs.Close这个方法啊~

难道是您没有表带清楚,我理解错了!
2008-05-12 20:05
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
Sub showpages( rs,Page )
   rs.AbsolutePage = Page        
        for i=0 to rs.pagesize-1
            j=j+1
            if j mod 2 =0 then
                bg="#EFEFF7"
            else
                bg="#ffffff"
            end if
            
            if rs("score")>=cint(zf*6/10) then
            fen="<font colot=#008000>"&rs("score")&"分</font>"
            bk="不需要"
            bfen="不需要"
            else
            fen="<font colot=red>"&rs("score")&"分</font>"
            bk="<a href=test_again.asp?studentnumber="&rs("studentnumber")&"&reportid="&reportid&">批准补考</a>"
            bfen="需要补考"
                if rs("pass")=True then
                bk="已批准补考"
                     if rs("makeup")=0 then
                    bfen="还未补考"
                    else
                        if rs("makeup")>=cint(zf*6/10) then
                        bfen="<font colot=#008000>"&rs("makeup")&"分</font>"
                        else
                        bfen="<font colot=red>"&rs("makeup")&"分</font>"
                        end if
                    end if
                end if
            end if            
            %>

    <tr bgcolor=<%=bg%>>
      <td align="center"><a href="student.asp?id=<%=rs("studentnumber")%>"><%=rs("studentname")%></a></td>
      <td align="center"> <%=fen%></td>
      <td align="center">
          <%=bk%></td>
      <td align="center">
          <%=bfen%></td>
    </tr>
    <%
        rs.movenext
          If rs.EOF Then Exit For
         Next%>
  <%End Sub
  
  end if %>  

    <tr>
      <td colspan="4" align="center">
     
     <form action=report.asp?keyword=<%=keyword%>&reportid=<%=reportid%> method="get" name=form1  >
          <%
        
        response.write rs.pagesize&"条一页  "
        if Page=1 then
               response.write"第一页  "
           end if
           If Page <> 1 Then
              Response.Write "<A HREF=report.asp?keyword="&keyword&"&reportid="&reportid&"&Page=1>第一页</A>?"
               Response.Write "<A HREF=report.asp?keyword="&keyword&"&reportid="&reportid&"&Page=" & (Page-1) & ">上一页</A>?"
           End If
           If Page <> rs.PageCount Then
             Response.Write "<A HREF=report.asp?keyword="&keyword&"&reportid="&reportid&"&Page=" & (Page+1) & ">下一页</A>?"
               Response.Write "<A HREF=report.asp?keyword="&keyword&"&reportid="&reportid&"&Page=" & rs.PageCount & ">最后一页</A>?"
          End If
           [bo]if page= rs.PageCount then [/bo] ' 这个是183行,应该是rs.PageCount引用出错,试试提前取得这个值。
              response.write"最后一页  "
          end if
        response.write "总共有"&rs.pagecount&"页, 目前是第"&page&"页"
          'response.write page&"/"&rs.pagecount&"页</center>"
        
%>
2008-05-12 21:53
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
为什么要麻烦回答问题的人来找出这个183行呢?

顺便……

           If Page <> rs.PageCount Then
             Response.Write "<A HREF=report.asp?keyword="&keyword&"&reportid="&reportid&"&Page=" & (Page+1) & ">下一页</A>?"
               Response.Write "<A HREF=report.asp?keyword="&keyword&"&reportid="&reportid&"&Page=" & rs.PageCount & ">最后一页</A>?"
          End If
           if page= rs.PageCount then
              response.write"最后一页  "
          end if

怎么会有这么糟糕的If判断……
2008-05-12 21:54
袜子
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2008-4-30
收藏
得分:0 
楼上的版主!我想告诉您!急急急!
你知道为什么要你找出183行吗!其实我的本意不是让您找出183行。只是我们看待183行的标准不一样,所以要帮我解决这个问题您必须自己找出183行!事实也证明我的说法是正确的!我不知道您是用什么方式打开这段代码的(因该不是数的吧)!那我用的是frontpage打开的,然后看到183行的代码和您的183行的内容是截然不同的(我的是这个内容:Response.Write "<A HREF=student.asp?keyword="&keyword&"&reportid="&reportid&"&Page=" & (Page-1) & ">上一页</A>?")。其实不管怎么 样只要能把问题解决掉就好!
         “if page= rs.PageCount then ' 这个是183行,应该是rs.PageCount引用出错,试试提前取得这个值。”我不东您的意思!是要怎么提前!具体的做法是什么??真的很谢谢您不闲麻烦的给我提意见!谢谢!不过问题好像还没有真正的解决!您还要辛苦下!
2008-05-12 23:07
袜子
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2008-4-30
收藏
得分:0 
补充上面的问题!!出错了
其实我的那个183行的内容是:If Page <> rs.PageCount Then
这句语句。刚才复制错了!不好意思!

我觉得应该就是rs.PageCount 的引用出错了!可是纠正的方法还是很不清楚!
2008-05-12 23:16
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
rs.open sql,conn,3,1,1
楼主可以试试将这行改为
rs.open sql,conn,1,1
或者楼主可以使用我写的那个分页程序来分页
https://bbs.bccn.net/viewthread.php?tid=37557&extra=page%3D1%26amp%3Bfilter%3Ddigest
2008-05-13 15:12
快速回复:编程就像生活一样!总是需要一些经验,别人的建议亦不可缺少!!
数据加载中...
 
   



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

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