Find a website from a foreign country (using GetString to improve the speed of ASP) I've tested it, it's a lot faster.

Source: Internet
Author: User
Tags html form
Many ASP programmers have run database queries and then display the results of the query in an HTML form
Come through the
Calendar Bar. That's what we usually do:
<%
"Create Connection/recordset
"Populate data into the Recordset object
% >
< TABLE >
<% do While not Rs. EOF% >
< TR >
< TD ><%=rs ("Field1")% ></td >
< TD ><%=rs ("Field2")% ></td >
.
</tr >
<% Rs. MoveNext
Loop% >
</table >
If the query results are many, the server explains your ASP script will take a lot of time, because there are many
The Response.Write statement is to be processed. If you put all the results of the output in a long string
(From <
TABLE > to </table >), then the server only needs to explain the Response.Write statement, the speed will
Much faster.
. Some of the most capable guys in Microsoft have turned their ideas into reality. (Note that this is an ADO 2.)
Only 0
The characteristics. If you are still using ADO 1.5 words, you can
http://www.microsoft.com/data/download.htm free download ADO 2.0)
With the GetString method, we can display all the output with just one Response.Write, which
Just like
is a do ... that can determine whether the recordset is EOF. Loop loop.
The use of GetString is as follows (all parameters are optional):
String = Recordset. GetString (StringFormat, NumRows, ColumnDelimiter,
RowDelimiter, nullexpr)
To generate an HTML table from the recordset's results, we only need to care about 3 of the 5 parameters of GetString
:
ColumnDelimiter (the HTML code that separates the columns of the Recordset), RowDelimiter (that separates the rows of the Recordset)
Html
Code), and nullexpr (the HTML code that should be generated when the current record is empty). It's like you're building HTML underneath.
of the table
As you can see in the example, each column is separated by < TD >...</td >, each line with < TR >...</tr >
Come on.
Take a look at the example code.
<%@ language= "VBSCRIPT"% >
<% Option Explicit "good coding technique
"Establish connection to DB
Dim Conn
Set conn = Server.CreateObject ("ADODB. Connection ")
Conn. Open "Dsn=northwind;"
"Create a recordset
Dim RS
Set rs = Server.CreateObject ("ADODB.") Recordset ")
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.