首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

帮小弟我解决下分页的有关问题,马上给分

2012-03-16 
帮我解决下分页的问题,马上给分TABLEcellPadding1align center cellSpacing1aligncenterborder1wi

帮我解决下分页的问题,马上给分
<TABLE   cellPadding=1   align= "center "   cellSpacing=1   align=center   border=1     width= "900 "   height= "1 "   >  
<%
      response.write " <tr> "
      response.write " <td     width=100>   需求单位     </td> "
      response.write " <td     width=100>   需求提出人   </td> "
      response.write " <td     width=100>   主旨   </td> "
      response.write " <td     width=100>   资讯主办   </td> "
      response.write " <td     width=100>   需求提出日期 </td> "
response.write " <td     width=100>   希望上线日期   </td> "
          response.write " <td     width=100>   预估完成日期     </td> "
      response.write " <td     width=100>   状态 </td> "
        response.write " <td     width=100>   说明 </td> </tr> "

Set   Rs   =   server.CreateObject( "Adodb.Recordset ")      
'sql= "select   APPLY_DEPARTMENT,APPLIER,MAJOR_IDEA,IT_UNDERTAKER,APPLY_TIME,WISH_FINISH_TIME,TOTESTTIME,REQUIRE_ESTI.PHASE   from   songzw.REQUIRE_BILL     inner   join   REQUIRE_ESTI     on   songzw.REQUIRE_BILL.IT_NO=REQUIRE_ESTI.IT_NO   "              

sql= "select   APPLY_DEPARTMENT,APPLIER,MAJOR_IDEA,IT_UNDERTAKER,APPLY_TIME,WISH_FINISH_TIME,TOTESTTIME,REQUIRE_ESTI.PHASE   from   songzw.REQUIRE_BILL     inner   join   REQUIRE_ESTI     on   songzw.REQUIRE_BILL.IT_NO=REQUIRE_ESTI.IT_NO     where   1=1 "      
 
    if     len(MAJOR_IDEA)> 0   then
    sql=sql   & "   and   MAJOR_IDEA   like   '% "&   MAJOR_IDEA   & "% ' "
  end   if  

if     len(APPLY_TIME_start)> 1   then
sql=sql   & "   and     APPLY_TIME   > = ' "&   APPLY_TIME_start   & " ' "
end   if

if     len(APPLY_TIME_end)> 1   then
sql=sql& "   and     APPLY_TIME   <= ' "&   APPLY_TIME_end   & " ' "
end   if


if   len(   WISH_FINISH_TIME_start)> 1   then
sql=sql& "   and     WISH_FINISH_TIME   > = ' "&   WISH_FINISH_TIME_start   & " ' "
end   if

if   len(WISH_FINISH_TIME_end)> 1   then
sql=sql& "   and     APPLY_TIME   <= ' "&   WISH_FINISH_TIME_end   & " ' "
end   if

if   len(IT_UNDERTAKER)> 1   then
    sql=sql& "   and   IT_UNDERTAKE   =   ' "&   IT_UNDERTAKE   & " ' "
    end   if

  if   len(PHASE)> 3     then
    sql=sql& "   and   PHASE= ' "&   PHASE   & " ' "  


    end   if
  Rs.open   SQL,CONN,1,1

      if   Not   rs.Eof   then     Rs.MoveFirst  
       
  if   sql   <>   "select   APPLY_DEPARTMENT,APPLIER,MAJOR_IDEA,IT_UNDERTAKER,APPLY_TIME,WISH_FINISH_TIME,TOTESTTIME,REQUIRE_ESTI.PHASE   from   songzw.REQUIRE_BILL     inner   join   REQUIRE_ESTI     on   songzw.REQUIRE_BILL.IT_NO=REQUIRE_ESTI.IT_NO     where   1=1 "     then
 
      Do   while   Not   rs.Eof
                      nAPPLY_DEPARTMENT=trim(rs.fields( "APPLY_DEPARTMENT "))
      nAPPLIER=trim(rs.fields( "APPLIER "))
                      nMAJOR_IDEA=trim(rs.fields( "MAJOR_IDEA "))
      nIT_UNDERTAKER=trim(rs.fields( "IT_UNDERTAKER "))
      nAPPLY_TIME=trim(rs.fields( "APPLY_TIME "))
                      nWISH_FINISH_TIME=trim(rs.fields( "WISH_FINISH_TIME "))
                      nTOTESTTIME=trim(rs.fields( "TOTESTTIME "))
                      nPHASE=trim(rs.fields( "PHASE "))
 
                 
            response.write " <tr> "
            response.write " <td     width=100> "   &   nAPPLY_DEPARTMENT   &   " </td> "
            response.write " <td     width=100> "   &   nAPPLIER   &   " </td> "
            response.write " <td     width=100> "   &   nMAJOR_IDEA   &   " </td> "
    response.write " <td     width=100> "   &   nIT_UNDERTAKER   &   " </td> "
    response.write " <td     width=100> "   &   nAPPLY_TIME   &   " </td> "
    response.write " <td     width=100> "   &   nWISH_FINISH_TIME   &   " </td> "
    response.write " <td     width=100> "   &   nTOTESTTIME   &   " </td> "
    response.write " <td     width=100> "   &   nPHASE   &   " </td> </tr> "
    Rs.MoveNext
      Loop
end   if
     
  %>

  </table>  

我想将查询的结果分页显示

向调用http://www.web23.cn/article/20074/11/638.html
通用分类代码要怎么改,全部分都给你了~~~~~~~~急的胃痛,麻烦麻烦你们~~~~~~~~~~~~~

[解决办法]
先创建一个rscL记录集
'===========================
set rsCL=server.CreateObject( "adodb.recordset ")
mysql = "select * from tbl_customer order by id desc "
rsCL.open mysql,conn,1,1


'=================================================
利用
while not rscl.eof
response.write rscl.fields( "f1 ")
rscl.movenext
wend
输出所有记录。
利用下面代码替换while not rscl.eof
'===============================================
i = 1
PageNo=replace(request( "PageNo "), " ' ", " ")
if not Isnumeric(PageNo) then
PageNo=1
end if
rsCL.pagesize=30 '每页多少纪录
TotalPages=rsCL.pagecount
if PageNo= " " or PageNo <1 then
PageNo=1
end if
if len(PageNo)> =5 then PageNo=1
if cint(pageNo)> cint(totalpages) then
pageNo=rsCL.pagecount
end if
totalpage=rsCL.pagecount
totalrecord=rsCL.recordcount
rsCL.AbsolutePage = PageNo
RowCount=rsCL.pagesize
while not rsCL.eof and Rowcount> 0
一行显示三天记录
'===================================================
for i=1 to rs.pagecount

<tr> if i mod 3=0 then <td> asdasd </td> </tr>
else
<td> asdasdasd </td>
end if
rs.movnext
next

利用下面代码替换wend
'===================================================
i = i + 1
rowcount=rowcount-1
rsCL.movenext
wend
'===================================================

下面是现实上一页下一页的代码,一般放在表格下面就行了

<form name= "frmPage " action= "?id=1 " method= "post ">
<table width= "100% " align= "center " bgcolor= "#FFFFFF " class= "no12 ">
<tr>
<td width= "36% " height= "23 " align= "center " class= "black ">
<%
if pageNo= " " then pageno=1
if totalPages= " " then TotalPages=1
if PageNo > 1 Then
response.write " <a href=?PageNo=1&id=1> 首页 </a> &nbsp;| <a href=?PageNo= " & (PageNo-1) & "&id=1> 上一页 </a> &nbsp;| "
end if
if TotalPages > 1 and cint(PageNo) <> cint(TotalPages) then
response.write " <a href=?PageNo= " & (PageNo+1) & "&id=1> 下一页 </a> |&nbsp; <a href=?PageNo= " & TotalPages & "&id=1> 末页 </a> &nbsp; "
end if
%> </td>
<td width= "19% " align= "left " class= "black "> 总共 <%=TotalRecord%> 条记录 </td>
<td width= "14% " align= "left "> <%Response.Write "Page: 转到第 "& PageNo & " / "& TotalPages & " "%> </td>
<td width= "4% " align= "left "> <input name= "pageNo " type= "text " id= "pageNo " size= "4 " maxlength= "5 " /> </td>
<td width= "27% " align= "left "> <input name= "button2 " type= "submit " id= "button2 " value= "GoTo " style= "border:1 solid #FFFFFF " /> </td>
</tr>
</table>
</form>

热点排行