当前位置:51VIP源码软件音乐小游戏下载联盟网络学院网络编程ASP技巧 → asp+oracle分页程序类(XDOWNPAGE2.0)

asp+oracle分页程序类(XDOWNPAGE2.0)

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2008-5-30 0:27:37 我要发布文章
_sqlcount.eof and rs_sqlcount.bof) then
   int_totalRecord=0
  else
   int_totalRecord=rs_sqlcount(0)
   int_totalRecord=clng(int_totalRecord)
  end if
  rs_sqlcount.close
  set rs_sqlcount=nothing
 end if
End sub

'================================================================
'GetConn  得到数据库连接
'
'================================================================
Public Property Let GetConn(obj_Conn)
 Set XD_Conn=obj_Conn
End Property

'================================================================
'GetSQL   得到查询语句
'
'================================================================
Public Property Let GetSQL(str_sql)
  if (str_sql<>"") then
      '根据给定查询语句,生成最终的查询语句(只取当前页内容):适用于oracle数据库
   XD_SQL=" select * from (select rownum r_n,temptable.* from ("
   XD_SQL=XD_SQL&str_sql
   XD_SQL=XD_SQL&" ) temptable ) where r_n between " & cstr((int_curpage -1) * XD_PageSize +1) & " and " & cstr(int_curpage * XD_PageSize)
   '查询总记录数的查询语句
   XD_Count_SQL="select count(*) from ("& str_sql & ")"
   end if
End Property


'================================================================
'GetSubmitForm属性   设置查询条件的表单
'
'================================================================

Public Property Let GetSubmitForm(frmName)
   SubmitForm=trim(frmName)
End Property

'================================================================
'GetSubmitForm1方法  输出分页导航所需脚本
'
'================================================================
public sub GetSubmitForm1()
  '页导航的javascript函数
  Response.Write " "+vrcrlf
  Response.Write ("<Script language=""javascript"">") +vbcrlf
  Response.Write "      function generalSubmit(i)"+vbcrlf
  Response.Write "      {"+vbcrlf
  Response.Write  "     document."&SubmitForm&".flag.value=""query1111111155555"";"+vbcrlf
  Response.Write  "     document."&SubmitForm&".currentpage.value=i;"+vbcrlf
  Response.Write  "     "&SubmitForm&".submit();"+vbcrlf
 
  Response.Write "      }"+vbcrlf
 
  '改变页大小的javascript函数
  Response.Write "    function changePageSize(ii)"+vbcrlf
  Response.Write "      {"+vbcrlf
  Response.Write  "     document."&SubmitForm&".flag.value=""query1111111155555"";"+vbcrlf
  Response.Write  "     document."&SubmitForm&".currentpage.value=1;"+vbcrlf
  Response.Write  "     document."&SubmitForm&".pagesize.value=ii;"+vbcrlf
  Response.Write  "     "&SubmitForm&".submit();"+vbcrlf

  Response.Write "      }"+vbcrlf
  Response.Write ("</Script>")+vbcrlf
  Response.Write " "+vrcrlf
end sub

'==================================================================
'totalRecordCount 属性
'关于记录总数
'
'==================================================================

Public Property Let totalRecordCount(int_totalRecordCount)
   If IsNumeric(int_totalRecordCount) Then
      int_totalRecord=CLng(int_totalRecordCount)
   End If
End Property

Public Property Get totalRecordCount
 If not(int_totalRecord="" or (not(IsNumeric(int_totalRecord)))) Then
  totalRecordCount=int_totalRecord
 End If
End Property
'==================================================================
'GetRecordCount 方法
'返回当前记录数
'
'==================================================================
public function GetRecordCount()
 GetRecordCount=int_totalRecord
end function
'==================================================================
'Class_Initialize 类的初始化
'初始化当前页的值
'
'==================================================================
Private Sub Class_Initialize
 '========================
 '设定一些参数的黙认值
 '========================
' XD_PageSize=10  '设定分页的默认值为10
 '========================
 '获取当前面的值
 '========================
 If Request("currentpage")="" Then
  int_curpage=1
 ElseIf not(IsNumeric(Request("currentpage"))) Then
  int_curpage=1
 ElseIf CInt(Trim(Request("currentpage")))<1 Then
  int_curpage=1
 Else
  Int_curpage=CInt(Trim(Request("currentpage")))
 End If

End Sub

'=============================================
'ShowPage  创建分页导航条
'有首页、前一页、下一页、末页、还有数字导航
'
'=============================================
Public Sub ShowPage()
 Dim str_tmp
 XD_sURL = GetUrl()
' int_totalRecord=XD_Rs.RecordCount
 If int_totalRecord<=0 Then
  str_error=str_error & "总记录数为零,请输入数据"
  Call ShowError()
 End If
 If int_totalRecord="" then
     int_TotalPage=1
 Else

'modify by wls 041215 For the right pages display---------------
  If int_totalRecord mod PageSize =0 Then
   int_TotalPage = CLng(int_TotalRecord \ XD_PageSize * -1)*-1
  Else
   int_TotalPage = CLng(int_TotalRecord \ XD_PageSize * -1)*-1+1
  End If

 End If

 If Int_curpage>int_Totalpage Then
  int_curpage=int_TotalPage
 End If

 '========================================================
 '显示分页信息,各个模块根据自己要求更改显求位置
 '========================================================
 'response.write " "
 str_tmp=ShowFirstPrv
 response.write str_tmp
 str_tmp=showNumBtn
 response.write str_tmp
 str_tmp=ShowNextLast
 response.write str_tmp
 str_tmp=ShowPageInfo
 response.write str_tmp
 Response.write " "
 ShowGoto

End Sub


'=============================================
'ShowFirstPrv  显示首页、前一页
'
'
'=============================================
Private Function ShowFirstPrv()
 Dim Str_tmp,int_prvpage

 If int_curpage=1 Then
  str_tmp=Btn_First&" "&Btn_

上一页  [1] [2] [3]  下一页