What is the most efficient way to refer to a recordset field value?
10.1 Test
So far we've been referencing field values in a recordset by name. Because this method requires every time to find the appropriate field, it is not efficient. To prove this, in the following test we refer to its value (ado__08.asp) by the index of the field in the collection:
' Write Data
Do as Not objrs.eof
Response.Write (_
"< TR >" & _
"< TD >" & objRS (0) & "</td >" & _
"< TD >" & objRS (1) & "</td >" & _
"< TD >" & objRS (2) & "</td >" & _
"< TD >" & objRS (3) & "</td >" & _
"< TD >" & objRS (4) & "</td >" & _
"< TD >" & objRS (5) & "</td >" & _
"< TD >" & objRS (6) & "</td >" & _
"</tr >" _
)
Objrs.movenext
Loop
As expected, there is a slight change in the cost of the page (perhaps because the code is slightly reduced). However, the improvement in the display time of this method is quite obvious.
In the next test, we bind all the fields to the variable (ado__09.asp):
If objrs.eof Then
Response.Write ("No Records Found")
Else
' Write headings
...
Dim fld0
Dim Fld1
Dim Fld2
Dim fld3
Dim Fld4
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