⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page.asp

📁 轩圆学生信息管理系统 081029修正了成绩数据浏览时查看单个学生成绩时总分排名显示表格问题。 //===============================================
💻 ASP
字号:
<%
Class Xdownpage
Private XD_PageCount,XD_Conn,XD_Rs,XD_SQL,XD_PageSize,Str_errors,int_curpage,str_URL,int_totalPage,int_totalRecord
'=================================================================
'PageSize	属性
'设置每一页的分页大小
'=================================================================
Public Property Let PageSize(int_PageSize)
	If IsNumeric(Int_Pagesize) Then
		XD_PageSize=CLng(int_PageSize)
	Else
		str_error=str_error & "PageSize的参数不正确"
		Call ShowError(str_error)
	End If
End Property
Public Property Get PageSize
	If XD_PageSize="" or (not(IsNumeric(XD_PageSize))) Then
		PageSize=10					
	Else
		PageSize=XD_PageSize
	End If
End Property
'=================================================================
'GetRS	属性
'返回分页后的记录集
'=================================================================
Public Property Get GetRs()
	Set XD_Rs=Server.createobject("adodb.recordset")
	XD_Rs.PageSize=PageSize
	XD_Rs.Open XD_SQL,XD_Conn,1,1
	If not(XD_Rs.eof and XD_RS.BOF) Then
		If int_curpage>XD_RS.PageCount Then
			int_curpage=XD_RS.PageCount
		End If
		XD_Rs.AbsolutePage=int_curpage
	End If
	Set GetRs=XD_RS
End Property
'================================================================
'GetConn		得到数据库连接
'================================================================	
Public Property Let GetConn(obj_Conn)
	If Not IsObject(obj_Conn) Then
		str_Error = "数据库链接属性错误。。。"
		Call ShowError(str_error)
	Else
		Set XD_Conn=obj_Conn
	End If
End Property
'================================================================
'GetSQL			得到查询语句
'================================================================
Public Property Let GetSQL(str_sql)
	XD_SQL=str_sql
End Property
'==================================================================
'Class_Initialize	类的初始化
'初始化当前页的值
'==================================================================	
Private Sub Class_Initialize
	'========================
	'设定一些参数的黙认值
	'========================
	XD_PageSize=10		'设定分页的默认值为10
	'========================
	str_error = "系统错误:<br>"
	'获取当前面的值
	'========================
	If request.querystring("page")="" Then
		int_curpage=1
	ElseIf not(IsNumeric(request.querystring("page"))) Then
		int_curpage=1
	ElseIf CInt(Trim(request.querystring("page")))<1 Then
		int_curpage=1
	Else
		Int_curpage=CInt(Trim(request.querystring("page")))
	End If
End Sub
'====================================================================
'ShowPage		创建分页导航条
'====================================================================
Public Sub ShowPage()
	Response.Write PageInfo()
End Sub
'====================================================================
Public Function PageInfo()
	Dim str_tmp,strHtml
	
	int_totalRecord=XD_RS.RecordCount
	'If int_totalRecord<=0 Then 
		'str_error=str_error & "总记录数为零,请输入数据"
		'Call ShowError(str_error)
	'End If
	If int_totalRecord<pagesize Then
		int_TotalPage=1
	Else
		If int_totalRecord mod PageSize =0 Then
			int_TotalPage = Int(int_TotalRecord / XD_PageSize * -1)*-1
		Else
			int_TotalPage = Int((int_TotalRecord / XD_PageSize * -1)*-1)+1
		End If
	End If
	If Int_curpage>int_Totalpage Then
		int_curpage=int_TotalPage
	End If
	'//此分页导航需要嵌入JavaScript分页文件
	strHtml = "<script language='javascript'>PageList("&int_curpage&",3,"&XD_PageSize&","&int_TotalRecord&",'"&GetUrl()&"',1,false)</script>"
	PageInfo = strHtml	
End Function
'====================================================================
'修改后的获取当前Url参数的函数
'Codeing by Redsun
'====================================================================
Private Function GetUrl()
	Dim ScriptAddress, M_ItemUrl, M_item
	ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME"))&"?"'取得当前地址
	If (Request.QueryString <> "") Then
		M_ItemUrl = ""
		For Each M_item In Request.QueryString
			If InStr("page",LCase(M_Item))=0 Then
				M_ItemUrl = M_ItemUrl & M_Item &"="& Server.URLEncode(request.querystring(""&M_Item&"")) & "&"
			End If
		Next
		ScriptAddress = ScriptAddress & M_ItemUrl'取得带参数地址
	End If
	GetUrl = ScriptAddress & "Page="
End Function
'====================================================================
' 设置 Terminate 事件。
'====================================================================
Private Sub Class_Terminate   
	If Not IsObject(XD_RS) Then Exit Sub
	'XD_RS.close()
	Set XD_RS = Nothing
End Sub
'====================================================================
'ShowError		错误提示
'====================================================================
Private Sub ShowError(SW_Error)
	Response.Write("<font color=""#FF0000""><br><br><li><b>" & SW_Error & "</font>")
	Response.End
End Sub
End class
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -