我在百度搜索才找到这里,这里应该是asp的天堂,有个问题求助大家帮助!
下面是一个“员工资料查询”的小程序,其他正常就是分页有问题,下面是首页代码index.asp,程序浏览必须index.asp?action=so这样,查询index.asp?action=soend都正常,分页index.asp?page=2,但分页有问题,点击下一页没有任何内容,大家分析一下弊病在那里?
<!--#include file="top.asp" -->
<script language="JavaScript">
<!--
function openwin1(url)
{
window.open(url,"_blank","height=350,width=320,resizable=no,scrollbars=yes,statue=no,toolbar=no,menubar=no,location=no,left=150,top=80");
}
// -->
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table width="801" align="right" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#D7D7D7"></td>
<td height="630" valign="top"><table width="618" cellspacing="0" cellpadding="0">
<tr>
<td></td>
</tr>
<tr>
<td align="center"><table width="96%" cellpadding="1" cellspacing="1">
<tr>
<td class="t"><br>
<%
Dim Action
Action=trim(request("Action"))
select case Action
case "so"
call Showso()
case "soend"
call soend()
end select
sub showso()
%>
<TABLE width="100%" border=0 align=center cellPadding=0 cellSpacing=1 bgcolor="#e7e7e7">
<TR>
<TD height="25" background="images/gradx.gif"><IMG height=16 src="images/blue_point.gif" width=16 align=absMiddle>员工身份查询</TD>
</TR>
<TR>
<TD bgcolor="#FFFFFF"><TABLE cellSpacing=0 cellPadding=6 width="100%" border=0>
<FORM name=form1 action=?action=soend method=post>
<TR>
<TD bgColor=#ffffff height=115>为了让您安全地购买本公司服务,您可以在此处查询公司员工资料,以鉴别其是否真实可靠。<br>
<br>
请输入员工姓名:
<INPUT name=key id="key">
<select name="search" size="1">
<option value="">请选择分类</option>
<option value="realname">按真实姓名</option>
<option value="sn">按员工编号</option>
<option value="tel">按电话号码</option>
</select>
<INPUT type=submit value=查询 name=Submit></TD>
</TR>
</FORM>
</TABLE>
</TD>
</TR>
</TABLE>
<%
end sub
sub soend()
%>
<TABLE width="100%" border=0 align=center cellPadding=0 cellSpacing=1 bgcolor="#e7e7e7">
<TR>
<TD height="25" background="images/gradx.gif"><IMG height=16 src="images/blue_point.gif" width=16 align=absMiddle>重新查询</TD>
</TR>
<FORM name=form1 action=?action=soend method=post>
<TR>
<TD height="30" bgcolor="#FFFFFF"> 请输入员工姓名:
<INPUT name=key id="key">
<select name="search" size="1">
<option value="">请选择分类</option>
<option value="realname">按真实姓名</option>
<option value="sn">按员工编号</option>
<option value="tel">按电话号码</option>
</select>
<INPUT type=submit value=查询 name=Submit></TD>
</TR>
</form>
</TABLE>
<br>
<TABLE width="100%" border=0 align=center cellPadding=0 cellSpacing=1 bgcolor="#e7e7e7">
<TR>
<TD height="25" background="images/gradx.gif"><IMG height=16 src="images/blue_point.gif" width=16 align=absMiddle>员工查询结果</TD>
</TR>
<TR>
<TD bgcolor="#FFFFFF"><br>
<%
dim strFileName
strFileName="index.asp"
pageno=10
dim sql,rs
dim search
sql="select * from staff"
if trim(request.Form("key"))<>"" then
if request("search")="realname" then
sql=sql&" where realname like '%"&trim(request.Form("key"))&"%'"
elseif request("search")="sn" then
sql=sql&" where sn like '%"&trim(request.Form("key"))&"%'"
elseif request("search")="tel" then
sql=sql&" where tel like '%"&trim(request.Form("key"))&"%'"
elseif request("search")="" then
sql=sql&" where realname like '%"&trim(request.Form("key"))&"%' or sn like '%"&trim(request.Form("key"))&"%' or business like '%"&trim(request.Form("key"))&"%' or branch like '%"&trim(request.Form("key"))&"%' or tel like '%"&trim(request.Form("key"))&"%' or mail like '%"&trim(request.Form("key"))&"%'"
end if
else
response.redirect"?Action=so"
end if
sql=sql&" order by SortNum asc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
rscount=rs.recordcount
%>
<%if rscount<1 then%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="tablecolor">
<tr>
<td height="25" colspan="8" align="center" class="tablebody"><%If request.Form("key")<>"" then%>
对不起,没有您所要查询的员工数据,请来此查询www.52725.com
<%
else
%>
没有员工数据!
<%End If%></td>
</tr>
</table>
<%else%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#00CCFF" class="tablecolor">
<tr bgcolor="#CAF4FF">
<td width="12%" height="25" align="center" background="images/st_bg.gif">真实姓名</td>
<td width="21%" align="center" background="images/st_bg.gif">员工编号</td>
<td width="16%" align="center" background="images/st_bg.gif">职务</td>
<td width="16%" align="center" background="images/st_bg.gif">部门</td>
<td width="20%" align="center" background="images/st_bg.gif">电话号码</td>
<td width="14%" align="center" background="images/st_bg.gif">上岗日期</td>
</tr>
<form name="form2" method="post" action="?action=edit" onSubmit="return checkf(form2)">
<%
call showsql(pageno)
rs.move(rsno)
for i=1 to loopno
%>
<tr bgcolor="#FFFFFF" >
<td height="25" align="center"><a href="javascript:openwin1('showstaff.asp?uid=<%=rs("id")%>')"><%=rs("realname")%></a></td>
<td align="center"><%=rs("sn")%></td>
<td align="center"><%=rs("business")%></td>
<td align="center"><%=rs("branch")%></td>
<td align="center"><%=rs("Tel")%></td>
<td align="center"><%=rs("duty")%></td>
</tr>
<%
rs.movenext
next
%>
</form>
<tr bgcolor="#FFFFFF">
<td colspan="6" align="right"><%call showpage(strFileName,rscount,pageno,true,true,"位员工")%></td>
</tr>
</table>
<%end if%><br></TD>
</TR>
</TABLE>
<%end sub%>
<br></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>