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

rs.absolutepage 总是-1的问题
<%@LANGUAGE= "vbSCRIPT "   CODEPAGE= "936 "%>
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 娱乐天地 </title>
<%
Set   conn=Server.CreateObject( "ADODB.Connection ")  
conn.open   "driver={sql   server};server=85.60.88.31;uid=sa;pwd=;database=pub_web; "
Set   rs=Server.CreateObject( "ADODB.Recordset ")   ' '创建Recordset对象
rs.PageSize=20
' '*设置查询语句  
StrSQL= "Select   id,v_name,up_user_name,convert(varchar(12),up_time,111)   as   uptime,click_num,author   from   mp3 "
'StrSQL= "select   *   from   mp3 "
rs.Open   StrSQL,conn,3,3
%>
<script   language=javascript>
//点击 "[第一页] "时响应:
function   PageFirst()
{  
document.MyForm.CurrentPage.selectedIndex=0;
document.MyForm.CurrentPage.onchange();
}
//点击 "[上一页] "时响应:
function   PagePrior()
{  
document.MyForm.CurrentPage.selectedIndex--;
document.MyForm.CurrentPage.onchange();
}
//点击 "[下一页] "时响应:
function   PageNext()
{  
document.MyForm.CurrentPage.selectedIndex++;
document.MyForm.CurrentPage.onchange();  
}
//点击 "[最后一页] "时响应:
function   PageLast()
{  
document.MyForm.CurrentPage.selectedIndex=document.MyForm.CurrentPage.length-1;
document.MyForm.CurrentPage.onchange();
}
//选择 "第?页 "时响应:
function   PageCurrent()
{   //Pages.asp是本程序的文件名
document.MyForm.action= 'yltd_1.asp?Page= '+(document.MyForm.CurrentPage.selectedIndex+1)
document.MyForm.submit();
}  
</Script>
</head>
<body   >
<table   width= "660 "     border= "1 "   align= "center "   bordercolor= "#000000 "   bgcolor= "#FFCCFF "   class= "fb_xx ">
<tr>

<%
IF   rs.Eof   THEN
Response.Write( " <font   size=2   color=#000080> [数据库中没有记录!] </font> ")
ELSE  
response.write   " <td   colspan=6> "
' '指定当前页码
If   Request( "currentPage ")= " "   Then
rs.AbsolutePage=1
Else
rs.AbsolutePage=CLng(Request( "currentPage "))
End   If  
'if   rs.AbsolutePage <1   then  
'rs.AbsolutePage=1   '在此赋值后输出rs.AbsolutePage仍为-1
'end   if
'response.write   "cs: "&Request( "currentPage ")
response.write   rs.AbsolutePage   '还是-1

' '创建表单MyForm,方法为Get
Response.Write( " <form   method=Get   name=MyForm> ")  
Response.Write( " <p   align=center> <font   size=2   color=#008000> ")
' '设置翻页超链接
if   rs.PageCount=1   then  
Response.Write( "[第一页]   [上一页]   [下一页]   [最后一页]   ")
else  
if   rs.AbsolutePage=1   then
Response.Write( "[第一页]   [上一页]   ")
Response.Write( "[ <a   href=javascript:PageNext()> 下一页 </a> ]   ")  
Response.Write( "[ <a   href=javasc