Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  advice: Just Say No to Session COM objects
     [next Lesson]  advice: Secure Code and Data

ASP Commandment #8: Property Reads are Expensive

Do not fetch any values obtained via ASP/COM more than once. Store them and use the stored values. It speeds up code significantly. Typical examples people forget this include recordset values, request.form and request.querystring.

This is bad (3 COM calls where 1 would accomplish same task):
<%
if rstemp("city")="Dallas" then
   ' do something

end if
if rstemp("city")="New York" then
   ' do something

end if
if rstemp("city")="New Orleans" then
   ' do something

end if
%>

This is good:
<%
thecity=rstemp("city")
if thecity="Dallas" then
   ' do something

end if
if thecity="New York" then
   ' do something

end if
if thecity="New Orleans" then
   ' do something

end if
%>

There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too. a $5 tip buys him lunch at McDonalds, a $20 tip buys his kid Hitoshi a new computer game, a $39 tip buys his daughter Michiko a few nice outfits. See our donor list.