The function of the method GetString of rs.getstring is to return the specified record set as a string. You can use this method to add HTML tables to the ASP file.
getstring method syntax
Setstr=objRecordset.GetString(format,n,coldel,rowdel,nullexpr)
| Parameter parameters | Description |
|---|---|
| format | Optional. A StringFormatEnum value that specifies the format when retrieving a Recordset as a string Optional parameters. Specify one |
| n | Optional. The number of rows to be converted in the Recordset RecordsetStringFormatEnum value. It is used to specify the format of extracting recordsets |
| coldel | Optional. If format is set to adClipString it is a column delimiter. Otherwise it is the tab character Optional parameters. If the format[format] value is set to adClipString, then it is a column delimiter; in addition, it is a tab[tab] |
| rowdel | Optional. If format is set to adClipString it is a row delimiter. Otherwise it is the carriage return character Optional parameters. Optional parameters. If the format[format] value is set to adClipString, then it is a line delimiter; in addition, it is a carriage return[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 Optional parameters. Optional parameters. If the format[format] value is set to adClipString, then it is an expression used to replace null values; in addition, it is a null character |
Tocreatean HTMLtable with data from maracordset, weonly need to use three of the parameter sabove:
We can create a record set data table in HTML format by simply passing one of the three parameters:
coldel-theHTMLtouseasacolumn-separator
coldel – Use HTML format as column separator
rowdel-theHTMLtouseasarow-separator
rowdel – Use HTML format line separators
NullExpr-theHTMLtouseifacolumnisNULL
NullExpr – If the column is empty, use HTML
Note:TheGetString() methodosanADO2.0 feature.
In the following case, we will use the GetString() method to preserve the record set as a string:
The code copy is as follows:
<html>
<body><%
setconn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"