top
Loading...
在客戶端執行數據庫記錄的分頁顯示----3
在結束之前,我想要快速地解釋一下怎樣在一個ASP頁面中使用這個類。由于這個類只包含一個方法,因此使用這個類相當簡單。你所需要做的就是創建并填充一個記錄集對象,然后創建一個類的例示,并使用Response.Write輸出objClassInstance.GenerateHTML(objRS)的值。

<!--#include file="dhtmlGetRows.class.asp"-->
<%
'Create and populate a Recordset
Dim objRS, objConn, strSQL
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=MyDSN"

strSQL = "SELECT TOP 25 ViewCount, Description " & _
"FROM tblFAQ ORDER BY ViewCount DESC"

Set objRS = objConn.Execute(strSQL)

'Create an instance of the dhtmlGetRows class
Dim objPagedResults
Set objPagedResults = new dhtmlGetRows

objPagedResults.THString = "<th>Views</th><th>FAQ Question</th>"
Response.Write objPagedResults.GenerateHTML(objRS)

'Clean up...
Set objPagedResults = Nothing

objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing
%>


以上的代碼片段假定dhtmlGetRows類可以在一個服務器端包含文件dhtmlGetRows.class.asp中使用。

北斗有巢氏 有巢氏北斗