标题:记录为空是提示
只看楼主
snddzxb
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-9-13
结帖率:0
已结贴  问题点数:20 回复次数:1 
记录为空是提示
问题1 :加载的时候不显示列表和无记录时提示。想修改成加载的时候只显示查询条件行,当有记录时显示记录列表,无记录时显示无记录提示(弹出提示或者页面提示都可以)。谢谢!
<body onLoad="javascript:StudentName();">
<table width="98%" border="0" align="center"  cellpadding="1" cellspacing="1" bordercolor="#cccccc" bgcolor="#999999">
  <tr>
    <td height="25" align="center" bgcolor="#e4e4e4"><b>毕业证查询</b></td>
  </tr>
<form id="form1" name="form1" method="post" action="?action=zhao_bh">
  <tr>
    <td height="25" align="center" bgcolor="#FFFFFF">姓名:&nbsp;<input name="StudentName" type="text" id="StudentName" size="30"/>&nbsp;<input type="submit" name="Submit" value="查找..." onClick="javascript:return checkStudentName();" />(不支持模糊查询)</td>
    </tr>
</form>
<form id="form2" name="form2" method="post" action="?action=zhao_mc">
  </form>
  </table>

<table id=DiplomasTable width="98%" border="0" align="center"  cellpadding="1" cellspacing="1" bordercolor="#cccccc" bgcolor="#999999">
  <tr height="25" bgcolor="#CCCCCC" align="center">
    <td width="10%"><strong>学校</strong></td>
    <td width="10%"><strong>年级</strong></td>
    <td width="10%"><strong>层次</strong></td>
    <td width="15%"><strong>专业</strong></td>
    <td width="15%"><strong>学号</strong></td>
    <td width="10%"><strong>姓名</strong></td>
    <td width="15%"><strong>毕业证到校时间</strong></td>
    <td width="5%"><strong>状态</strong></td>
  </tr>
  <%
  action=trim(request.querystring("action"))
   select case action
   case "zhao_bh"
       StudentName=request.form("StudentName")
Set rs= Server.CreateObject("ADODB.RecordSet")
sql=  "select * from View_DiplomasManage where xm ='"&StudentName&"'"
rs.open sql,conn,1,1
  case "zhao_mc"
      ClassName=request.form("ClassName")
     Set rs= Server.CreateObject("ADODB.RecordSet")
sql=  "select * from View_DiplomasManage where classname like '%"&classname&"%'"
rs.open sql,conn,1,1
  case ""
 Set rs= Server.CreateObject("ADODB.RecordSet")
sql=  "select * from View_DiplomasManage where 1=0"
rs.open sql,conn,1,1
end select
 If (rs.bof and rs.eof) then
  Response.Write("对不起没有你的毕业证,请联系班主任老师核对!")
    rs.close
    set rs=nothing
    response.End()
   End If

if not rs.eof then

    const maxperpage=20 '定义每一页显示的数据记录的常量
    dim currentpage '定义当前页的变量
    rs.pagesize=maxperpage
    currentpage=request("page")
        if currentpage="" or not Isnumeric(currentpage) then
            currentpage=1
            elseif currentpage<1 then
            c1urrentpage=1
        else
            currentpage=clng(currentpage)
            if currentpage > rs.pagecount then
                currentpage=rs.pagecount
            end if
        end if
'如果变量c1urrentpage的数据类型不是数值型
'就1赋给变量c1urrentpage
        if not isnumeric(currentpage) then
        currentpage=1
        end if
dim totalput,n '定义变量
totalput=rs.recordcount
if totalput mod maxperpage=0 then
n=totalput\maxperpage
else
n=totalput\maxperpage+1
end if
if n=0 then
n=1
end if
rs.move(currentpage-1)*maxperpage
i=0
do while i< maxperpage and not rs.eof
i=i+1
   
%>

<tr height="25" bgcolor="#FFFFFF" align="center">
       <td><%=rs("xxid")%></td>
        <td><%=rs("njid")%></td>
     <td><%=rs("ccid")%></td>
     <td><%=rs("zyid")%></td>
    <td><%=rs("xh")%></td>
    <td><%=rs("xm")%></td>
    <td><%=rs("byzdxsj")%></td>
    <td><%=rs("status")%></td>
  </tr>
  <%
      rs.movenext
    loop
end if
  rs.close
  set rs=nothing
  %>
  <tr>
    <td colspan="8" align="right">
页数 <font color="red"><%=currentpage%></font>/<% =n%>
    <% k=currentpage                    
       if k<>1 then%>
       [<a class="link" href="index.asp?page=1">首页</a>]                    
       [<a class="link" href="index.asp?page=<%=k-1%>">上一页</a>]                    
       <%else%>
       [首页]&nbsp;[上一页]                    
       <%end if%>
       <%if k<>n then%>                    
       [<a class="link" href="index.asp?page=<%=k+1%>">下一页</a>]                    
       [<a class="link" href="index.asp?page=<%=n%>">尾页</a>]                    
       <%else%>
       [下一页]&nbsp;[尾页]                    
       <%end if%>
        共有<font color="red"><%=totalput%></font>条记录 <font color="red"><%=maxperpage%></font>个/页
      共有<font color="red"><%=n%></font>页    </td>
  </tr>
</table>
</body>
搜索更多相关主题的帖子: javascript 毕业证查询 cccccc action border 
2014-01-23 10:42
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:20 
你第一次查询后加判断if rs.eof然后输出个提示即可
2014-01-23 14:19



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




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

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