在结束之前,我想要快速地解释一下怎样在一个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中使用。
<!--#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中使用。
相关信息
- 关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 管理登陆
- Copyright © 2003-2007 ZhuYe123.COM. All Rights Reserved . 粤ICP备05072659号
- 致力于中国个人网站发展,我们一直在努力!