asp ADO GetString函數(shù)與用GetString來提高ASP的速度第1/2頁
getstring 方法語法
Set str=objRecordset.GetString(format,n,coldel,rowdel,nullexpr)
Parameter參數(shù) | Description描述 |
---|---|
format | Optional. A StringFormatEnum value that specifies the format when retrieving a Recordset as a string 可選參數(shù)。指定一個 |
n |
Optional. The number of rows to be converted in the Recordset |
coldel | Optional. If format is set to adClipString it is a column delimiter. Otherwise it is the tab character 可選參數(shù)。如果format[格式]值設(shè)置為adClipString,那么它就是一個列界定符;除此之外,它便是一個tab[制表符] |
rowdel | Optional. If format is set to adClipString it is a row delimiter. Otherwise it is the carriage return character 可選參數(shù)??蛇x參數(shù)。如果format[格式]值設(shè)置為adClipString,那么它就是一個行界定符;除此之外,它便是一個carriage return [回車符] |
nullexpr | Optional. If format is set to adClipString it is an expression used instead of a null value. Otherwise it is an empty string 可選參數(shù)??蛇x參數(shù)。如果format[格式]值設(shè)置為adClipString,那么它就是一個用于替代空值的表達(dá)式;除此之外,它便是一個空字符 |
To create an HTML table with data from a recordset, we only need to use three of the parameters above:
我們只要通過上述三個參數(shù)中的一個就可以創(chuàng)建HTML格式的記錄集數(shù)據(jù)表:
coldel - the HTML to use as a column-separator
coldel – 使用HTML格式作為列分隔符
rowdel - the HTML to use as a row-separator
rowdel – 使用HTML格式行分隔符
NullExpr - the HTML to use if a column is NULL
NullExpr – 如果列為空,則使用HTML
Note: The GetString() method is an ADO 2.0 feature.
在下面的案例中,我們將使用GetString()方法將記錄集以一個字符串的形式保留:
<html>
<body><%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT Companyname, Contactname FROM Customers", connstr=rs.GetString(,,"</td><td>","</td></tr><tr><td>"," ")
%><table border="1" width="100%">
<tr>
<td><%Response.Write(str)%></td>
</tr>
</table><%
rs.close
conn.close
set rs = Nothingset conn = Nothing%></body>
</html>
Constant 常量 |
Value 值 |
Description 描述 |
---|---|---|
adClipString | 2 | Delimits rows by the rowdel parameter, columns by the coldel parameter, and null values by the nullexpr parameter 指定rowdel參數(shù)對行(記錄)進(jìn)行界定;通過coldel參數(shù)對列(字段)進(jìn)行界定,通過nullexpr參數(shù)對空值進(jìn)行界定 |
相關(guān)文章
用asp實現(xiàn)把文件打包成Xml文件包,帶解包的ASP工具附下載
用asp實現(xiàn)把文件打包成Xml文件包,帶解包的ASP工具附下載...2007-06-06ASP 三層架構(gòu) Convert類實現(xiàn)代碼
第二個重要的類,作用是類型轉(zhuǎn)換,類名Con_Convert.在頁面代碼的開頭實例化,對象名為Convert,借用了.net的類型轉(zhuǎn)換的對象名稱.2009-09-09asp中用數(shù)據(jù)庫生成不重復(fù)的流水號
asp中用數(shù)據(jù)庫生成不重復(fù)的流水號的實現(xiàn)代碼,需要的朋友可以參考下實現(xiàn)原理其它程序一樣。2006-09-09ASP基礎(chǔ)入門第六篇(ASP內(nèi)建對象Request)
從本篇開始作者從 ASP 內(nèi)建對象著手,為大家詳細(xì)剖析 ASP 的六個內(nèi)建對象和各種組件的特性和方法,需要的朋友可以參考下2015-10-10ASP中RecordSet Open和Connection.Execute一些區(qū)別與細(xì)節(jié)分享
這篇文章主要介紹了ASP中RecordSet Open和Connection.Execute一些區(qū)別與細(xì)節(jié)分享,需要的朋友可以參考下2020-08-08忠網(wǎng)廣告 系統(tǒng) 用到的幾個函數(shù)
忠網(wǎng)廣告 系統(tǒng) 用到的幾個函數(shù)...2006-11-11