Asp ado getstring function and getstring to improve ASP speed page 1/2

Source: Internet
Author: User
Tags define null

The RS. getstring method getstring is used to return the specified record set in the form of a string. You can use this method to add HTML tables to ASP files.
Getstring method syntax
Set STR = 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. Specify
N

Optional. The number of rows to be converted in the recordset
Recordsetstringformatenum value. It is used to specify the format for extracting Record Sets

Coldel Optional. If format is set to adclipstring it is a column delimiter. Otherwise it is the Tab character
Optional. If the format [format] value is set to adclipstring, 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. Optional. If the format [format] value is set to adclipstring, 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. Optional. If the format [format] value is set to adclipstring, it is an expression used to replace null values. In addition, it is an empty character.

Case
To create an HTML table with data from A recordset, we only need to use three of the parameters above:
You only need to use one of the preceding three parameters to create an HTML record set data table:

Coldel-the HTML to use as a column-separator
Coldel-use HTML format as column Separator
Rowdel-the HTML to use as a row-separator
Rowdel-use the line Separator in HTML Format
Nullexpr-the HTML to use if a column is null
Nullexpr-if the column is empty, use HTML
Note: The getstring () method is an ADO 2.0 feature.
In the following case, we will use the getstring () method to keep the record set as a string:

CopyCode The Code is as follows: <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 MERs", connstr = Rs. getstring (, "</TD> <TD>", "</TD> </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
constant
value
value
description
description
adclipstring 2 delimits rows by the rowdel parameter, columns by the coldel parameter, and null values by the nullexpr parameter
specify the rowdel parameter to define the row (record; use the coldel parameter to define columns (fields) and the nullexpr parameter to define null values
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.