能帮我解决个简单的分页问题吗???????
<%
StrConn= "DRIVER={SQL Server};SERVER=semhq29;UID=sa;PWD=sema512;DATABASE=DDS_DB "
Set Conn = Server.CreateObject( "ADODB.Connection ")
Conn.Open StrConn
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 "
rs.Open sql, conn, 1
page=1
rs.PageSize = 5
if Not IsEmpty(Request( "Page ")) then
Page = CInt(Request( "Page "))
if Page > rs.PageCount then
rs.AbsolutePage = rs.PageCount
elseif Page <= 0 then
Page = 1
else
rs.AbsolutePage = Page
end if
End if
Page = rs.AbsolutePage
%>
<%
For i = 1 to rs.PageSize
if rs.EOF then
Exit For
end if
%>
<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>
<%if request( "page ")> 1 then%> <a Href= "dispose_demand.asp?Page= <% = 1%> "> 首页 </a> <a Href= "dispose_demand.asp?Page= <% =request( "page ") -1 %> "> 上一页 </a> <%end if %> <%if request( "page ") <> rs.pagecount then %> <a Href= "dispose_demand.asp?Page= <% =request( "page ") + 1%> "> 下一页 </a> <a Href= "dispose_demand.asp?Page= <% = rs.PageCount%> "> 尾页 </a> <% end if %>
<%
rs.close
Set rs = Nothing
conn.close
set conn=nothing
%>
这哪里错了,实现不了分页啊
说缺少“next”
帮帮忙吧
[解决办法]
<%
next
rs.close
Set rs = Nothing
conn.close
set conn=nothing
%>
-------------------------
在上面加一个试一下,你上面有一个for
下面当然要对应一个next
[解决办法]
For i = 1 to rs.PageSize
这里用了for那next呢?
代码好乱!!!!!!!!!!