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: Write Your SQL
     [next Lesson]  advice: Clean Up Your Room, I mean Objects

ASP Commandment #4: Named Constants

Command #4: use named constants from adovbs.inc instead of numeric constants. (granted, adovbs.inc isn't complete and requires some add'l tweaking from time-to-time)

This is good:
<!--#INCLUDE VIRTUAL="/ADOVBS.INC" -->
<%
connectme="DSN=Student;uid=student;pwd=magic"
sqltemp="select * from publishers where state='NY'"
set rstemp=Server.CreateObject("adodb.Recordset")
rstemp.open sqltemp, connectme, adopenstatic
response.write rstemp.recordcount & " records in<br>" & sqltemp
rstemp.close
set rstemp=nothing

%>

This is bad:
<%
connectme="DSN=Student;uid=student;pwd=magic"
sqltemp="select * from publishers where state='NY'"
set rstemp=Server.CreateObject("adodb.Recordset")
rstemp.open sqltemp, connectme, 3
response.write rstemp.recordcount & " records in<br>" & sqltemp
rstemp.close
set rstemp=nothing

%>

Chaz Wish List
Tall Tip $5
Grande Tip $20
Venti Tip $39
Tip Jar Thanks
2004 Thanks
2005 Thanks
HUGE Tip -love site