我需要帮助与我的asp项目,
有一个循环在我的页面,其中只有一行从表是循环通过整个页面,而不是我想显示只有一行,然后我想添加一个按钮/链接加载第二行,然后第三行,第四行和wards。
我怎样才能做到这一点?
我的代码
<%
if session("usr")="" then
response.Redirect("authentication.asp")
end if
Set Rs=con.execute("select * from Std_Profile where uid=" & session("usr") & "")
Dim ccode
ccode=Rs("Class_Code")
Set RSlecture=con.execute("select * from eva_lecture where Class_Code='"& ccode &"' ")
Set RSques=con.execute("select * from eva_ques ")
Dim PageLen,PageNo,TotalRecord,TotalPage,No,intID
PageLen = 1
PageNo = Request.QueryString("Page")
if PageNo = "" Then PageNo = 1
TotalRecord = RSlecture.RecordCount
RSlecture.PageSize = PageLen
TotalPage = RSlecture.PageCount
RSlecture.AbsolutePage = PageNo
%>
<div class="activity">
<%
No=1
Do While Not RSlecture.EOF and No <= PageLen
%>
<h3><strong>Q#<% Response.Write(RSques("ques_no"))%> : <% Response.Write(RSques("ques"))%></strong></h3>
<br />
<table width="837" border="1" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td width="79" bgcolor="#6699CC"><strong>Subject</strong></td>
<td width="74" bgcolor="#6699CC"><strong>Teacher</strong></td>
<td width="120" bgcolor="#6699CC"><strong>Option #1</strong></td>
<td width="120" bgcolor="#6699CC"><strong>Option #2</strong></td>
<td width="120" bgcolor="#6699CC"><strong>Option #3</strong></td>
<td width="120" bgcolor="#6699CC"><strong>Option #4</strong></td>
</tr>
</table>
<% 'While Not RSlecture.EOF %>
<table width="837" border="1" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td width="79"><% Response.Write(RSlecture("subject"))%></td>
<td width="74"><% Response.Write(RSlecture("teacher"))%></td>
<td width="120"><% Response.Write(RSques("opt1"))%></td>
<td width="120"><% Response.Write(RSques("opt2"))%></td>
<td width="120"><% Response.Write(RSques("opt3"))%></td>
<td width="120"><% Response.Write(RSques("opt4"))%></td>
</tr>
</table>
<%
No = No + 1
RSlecture.MoveNext
Loop
%>
Total : <%=TotalRecord%> Records. Page <%=PageNo%> (All Page <%=TotalPage%>)
<% IF Cint(PageNo) > 1 then %>
<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Page=1"><< First</a>
<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Page=<%=PageNo-1%>">< Back</a>
<% End IF%>
<% IF Cint(PageNo) < TotalPage Then %>
<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Page=<%=PageNo+1%>">Next ></a>
<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Page=<%=TotalPage%>">Last >></a>
<% End IF%>
<br>
Go to
<% For intID = 1 To TotalPage%>
<% if intID = Cint(PageNo) Then%>
<b><%=intID%></b>
<%Else%>
<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Page=<%=intID%>"><%=intID%></a>
<%End IF%>
<%Next%>
<div>
返回错误类型:ADODB。记录集(0 x800a0cb3)当前记录集不支持书签。
你的命令顺序不对。试试这个:
Set RSques=con.execute("select * from eva_ques ")
Dim PageLen, PageNo, TotalRecord, TotalPage, No, intID
PageLen = 1
PageNo = Request.QueryString("Page")
if PageNo = "" Then PageNo = 1
Set RSlecture = Server.CreateObject("ADODB.Recordset")
RSlecture.CursorLocation = 3 'adUseClient
RSlecture.Open "select * from eva_lecture where Class_Code='"& ccode &"' ", con
RSlecture.PageSize = PageLen
RSlecture.AbsolutePage = PageNo
TotalRecord = RSlecture.RecordCount
TotalPage = RSlecture.PageCount