叶子asp分页类(4)
Response.Cookies("ShowoPage")(sPageName)=i
Response.Cookies("ShowoPage")("sCond")=sCondition
End If
Else
i=oConn.Execute("SELECT COUNT("&sPkey&") FROM "&sTable&" "&sCondition,0,1)(0)
End If
iRecCount=i
RecCount=i
End Property
''================================================================
'' ResultSet 返回分页后的记录集
''================================================================
Public Property Get ResultSet()
s=Null
''记录总数
i=iRecCount
''当前页
If i>0 Then
iPageCount=Abs(Int(-Abs(i/iPageSize)))''页数
iPageCurr=CheckNum(Request.QueryString(sPageName),1,1,1,iPageCount)''当前页
Select Case sDbType
Case "MSSQL" ''sqlserver2000数据库存储过程版
Set Rs=server.CreateObject("Adodb.RecordSet")
Set Cm=Server.CreateObject("Adodb.Command")
Cm.CommandType=4
Cm.ActiveConnection=oConn
Cm.CommandText="sp_Util_Page"
Cm.parameters(1)=i
Cm.parameters(2)=iPageCurr
Cm.parameters(3)=iPageSize
Cm.parameters(4)=sPkey
Cm.parameters(5)=sField
Cm.parameters(6)=sTable
Cm.parameters(7)=Replace(sCondition," WHERE ","")
Cm.parameters(8)=Replace(sOrderBy," ORDER BY ","")
Rs.CursorLocation=3
Rs.LockType=1
Rs.Open Cm
Case "MYSQL" ''MYSQL数据库
ResultSet_Sql="SELECT "&sField&" FROM "&sTable&" "&sCondition&" "&sOrderBy&" LIMIT "&(iPageCurr-1)*iPageSize&","&iPageSize
Set Rs=oConn.Execute(ResultSet_Sql)
Case Else ''其他情况按最原始的方法处理(AC同理)
Set Rs = Server.CreateObject ("Adodb.RecordSet")
ResultSet_Sql="SELECT "&sField&" FROM "&sTable&" "&sCondition&" "&sOrderBy
Rs.Open ResultSet_Sql,oConn,1,1,&H0001
Rs.AbsolutePosition=(iPageCurr-1)*iPageSize+1
End Select
内容版权声明:除非注明,否则皆为本站原创文章。