Don't save the use of variables

Source: Internet
Author: User
Variable now, might is wondering, what does he mean, Don ' t skimp on the variables? So, often times it's more
Efficient to "variables to" store results from ADO queries or from objects, and then reference the
Variable as opposed to continuously referencing the object.

For example, your could do this:


If request.querystring ("Name") = "Frank" Then
...
End If

If request.querystring ("Name") = "Steve" Then
...
End If

Response.Write ("Your name is" & Request.QueryString ("name"))
Use the ' Request object ', ASP has to go read the QueryString variable name. You can reduce
This to have to just read this once by doing the following:


Dim StrName
StrName = Request.QueryString ("Name")

If strName = "Frank" Then
...
End If

If strName = "Steve" Then
...
End If

Response.Write ("Your name is" & StrName)
Plus, I Personally the above scenario is easier to read. It ' s easier, I am, to mentally associate
StrName to is the user ' s name as opposed to associating Request.QueryString ("name") as the user ' s name.
Just my two cents, though!



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.