记录为空是提示
问题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">姓名: <input name="StudentName" type="text" id="StudentName" size="30"/> <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%>
[首页] [上一页]
<%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%>
[下一页] [尾页]
<%end if%>
共有<font color="red"><%=totalput%></font>条记录 <font color="red"><%=maxperpage%></font>个/页
共有<font color="red"><%=n%></font>页 </td>
</tr>
</table>
</body>