asp+access分页查询为什么只能显示第一页,不能显示其他页 15
<%SubPageControl(iCount,pagecount,page,table_style,font_style)'生成上一页下一页链接Dimquery,a,x...
<%
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x,"=")
If StrComp(a(0),"page",vbTextCompare)<>0 Then
temp = "+tab+"&a(0)&"="&a(1)&"&"
End If
Next
Response.Write("<table width=100% border=0 cellpadding=0 cellspacing=0 bgcolor=#f1f1f1>" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '"&action&"?" &temp& "Page='+ this.page.value;return false;""><TR bgcolor=#f1f1f1>" & vbCrLf )
Response.Write("<TD align=center height=35>" & vbCrLf )
Response.Write(font_style & vbCrLf )
if page<=1 then
Response.Write ("首 页" &vbCrLf)
Response.Write ("上一页" &vbCrLf)
else
Response.Write("<A HREF="& action&"?" &temp& "Page=1>首 页</A> " & vbCrLf)
Response.Write("<A HREF="& action&"?" &temp& "Page="&(Page-1)&">上一页</A>"&vbCrLf)
end if
if page>=pagecount then
Response.Write ("下一页"& vbCrLf)
Response.Write ("尾 页" &vbCrLf)
else
Response.Write("<A HREF="&action&"?"&temp&"Page="&(Page+1)&">下一页</A>"&vbCrLf)
Response.Write("<A HREF="&action&"?"&temp&"Page="&pagecount&">尾 页</A>"&vbCrLf)
end if
Response.Write(" 页次:" &page&"/"&pageCount&"页"&vbCrLf)
Response.Write(" 共有"&iCount&"条信息"&vbCrLf)
Response.Write(" 转到"&"<INPUT CLASS=wenbenkuang TYEP=TEXT NAME=page SIZE=2 Maxlength=5 VALUE="&page&">"&"页"&vbCrLf&"<INPUT CLASS=go-wenbenkuang type=submit value=' 转 到 '>")
Response.Write("</TD>"&vbCrLf )
Response.Write("</TR></form>"&vbCrLf )
Response.Write("</table>"&vbCrLf )
End Sub
%></td></tr><%
end If
%>
当把exec="select * from "+tab+""语句换成固定表名字exec="select * from test"分页正常,能显示所有页,但是表名字换成变量就不行,为什么啊,参数怎么传递下去啊 展开
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x,"=")
If StrComp(a(0),"page",vbTextCompare)<>0 Then
temp = "+tab+"&a(0)&"="&a(1)&"&"
End If
Next
Response.Write("<table width=100% border=0 cellpadding=0 cellspacing=0 bgcolor=#f1f1f1>" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '"&action&"?" &temp& "Page='+ this.page.value;return false;""><TR bgcolor=#f1f1f1>" & vbCrLf )
Response.Write("<TD align=center height=35>" & vbCrLf )
Response.Write(font_style & vbCrLf )
if page<=1 then
Response.Write ("首 页" &vbCrLf)
Response.Write ("上一页" &vbCrLf)
else
Response.Write("<A HREF="& action&"?" &temp& "Page=1>首 页</A> " & vbCrLf)
Response.Write("<A HREF="& action&"?" &temp& "Page="&(Page-1)&">上一页</A>"&vbCrLf)
end if
if page>=pagecount then
Response.Write ("下一页"& vbCrLf)
Response.Write ("尾 页" &vbCrLf)
else
Response.Write("<A HREF="&action&"?"&temp&"Page="&(Page+1)&">下一页</A>"&vbCrLf)
Response.Write("<A HREF="&action&"?"&temp&"Page="&pagecount&">尾 页</A>"&vbCrLf)
end if
Response.Write(" 页次:" &page&"/"&pageCount&"页"&vbCrLf)
Response.Write(" 共有"&iCount&"条信息"&vbCrLf)
Response.Write(" 转到"&"<INPUT CLASS=wenbenkuang TYEP=TEXT NAME=page SIZE=2 Maxlength=5 VALUE="&page&">"&"页"&vbCrLf&"<INPUT CLASS=go-wenbenkuang type=submit value=' 转 到 '>")
Response.Write("</TD>"&vbCrLf )
Response.Write("</TR></form>"&vbCrLf )
Response.Write("</table>"&vbCrLf )
End Sub
%></td></tr><%
end If
%>
当把exec="select * from "+tab+""语句换成固定表名字exec="select * from test"分页正常,能显示所有页,但是表名字换成变量就不行,为什么啊,参数怎么传递下去啊 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询