日期:2014-05-17  浏览次数:20994 次

求助!!!asp查询分页第一页正确,第二页起为全部内容
详细代码如下
<!--#include file="conn.asp"-->
<%dim adminlogin
adminlogin=session("adminlogin")
if adminlogin<>true then

response.write("<script language='javascript'>")
response.write("alert('您没有登录,请登录!');")
response.write("adminlogin.asp")
response.write("</Script>")
response.end

end if%>
<%
if session("userqx") <> 00 and session("userqx")<>11 then
response.write "对不起 您无权访问本页"
response.end
session.timeout=5 
Session.Abandon
Response.redirect("adminlogin.asp")
end if
%>
<%
dim action,ksh1,xm1,sfzh1
call search()
%>
<%

dim pages,Curpage
pages=Trim(request.form("pages"))
Curpage=request("curpage")
if pages="" then
  If curpage = "" or curpage < 0 then  
  Curpage=1  
  Else  
  Curpage=cint(curpage)  
  End if 
else
  curpage=cint(pages)
end if

dim i,id,rs,objRs
i=1


sub search()
ksh1=request("ksh1")
sfzh1=request("sfzh1")
xm1=request("xm1")
if ksh1="" and sfzh1="" and xm1="" then
sql="select xm,xb,sfzh,mz,kstz,bkcc,bkkl,ysyz,bkzy,zslb,zsbyz,ksh,jxd,jtd,cknf from [ckbmk] order by cknf desc,mid(ksh,7,5) asc"
Set objRs=Conn.Execute("Select count(*) From ckbmk")'/*记录统计
elseif ksh1<>"" and len(ksh1)=11 and sfzh1="" and xm1="" then
sql="select xm,xb,sfzh,mz,kstz,bkcc,bkkl,ysyz,bkzy,zslb,zsbyz,ksh,jxd,jtd,cknf from [ckbmk] where ksh='"&ksh1&"' order by cknf desc,mid(ksh,7,5) asc"
Set objRs=Conn.Execute("Select count(*) From ckbmk where ksh='"&ksh1&"'")'/*记录统计
elseif ksh1="" and sfzh1="" and xm1<>"" then
sql="select xm,xb,sfzh,mz,kstz,bkcc,bkkl,ysyz,bkzy,zslb,zsbyz,ksh,jxd,jtd,cknf from [ckbmk] where xm like '%"&xm1&"%' order by cknf desc,mid(ksh,7,5) asc"
Set objRs=Conn.Execute("Select count(*) From ckbmk where xm like '%"&xm1&"%'")'/*记录统计
elseif ksh1="" and sfzh1<>"" and len(sfzh1)=18 and xm1="" then
sql="select xm,xb,sfzh,mz,kstz,bkcc,bkkl,ysyz,bkzy,zslb,zsbyz,ksh,jxd,jtd,cknf from [ckbmk] where sfzh='"&sfzh1&"' order by cknf desc,mid(ksh,7,5) asc"
Set objRs=Conn.Execute("Select count(*) From ckbmk where sfzh='"&sfzh1&"'")'/*记录统计
elseif ksh1<>"" and len(ksh1)=11 and sfzh1<>"" and len(sfzh1)=18 and xm1="" then
sql="select xm,xb,sfzh,mz,kstz,bkcc,bkkl,ysyz,bkzy,zslb,zsbyz,ksh,jxd,jtd,cknf from [ckbmk] where ksh='"&ksh1&"' and sfzh='"&sfzh1&"' order by cknf desc,mid(ksh,7,5) asc"
Set objRs=Conn.Execute("Select count(*) From ckbmk where ksh='"&ksh1&"' and sfzh='"&sfzh1&"'")'/*记录统计
elseif ksh1<>"" and len(ksh1)=11 and xm1<>"" and sfzh1="" then
sql="select xm,xb,sfzh,mz,kstz,bkcc,bkkl,ysyz,bkzy,zslb,zsbyz,ksh,jxd,jtd,cknf from [ckbmk] where ksh='"&ksh1&"' and xm like '%"&xm1&"%' order by cknf desc,mid(ksh,7,5) asc"
Set objRs=Conn.Execute("Select count(*) From ckbmk where ksh='"&ksh1&"' and xm like '%"&xm1&"%'")'/*记录统计
elseif ksh1="" and sfzh1<>"" and len(sfzh1)=18