[thelist] FileExists problem [WAS VBScript/ASP string concatenation problem]

Ken Schaefer Ken at adOpenStatic.com
Wed Jul 27 18:54:26 CDT 2005


: -----Original Message-----
: From: thelist-bounces at lists.evolt.org [mailto:thelist-
: bounces at lists.evolt.org] On Behalf Of Pringle, Ron
: Subject: [thelist] FileExists problem [WAS VBScript/ASP string
: concatenation problem]
: 
: Josh, you asked:
: 
: >I must ask... why are you using the _complicated_ method to access
: > values? Is there a reason you don't use this syntax?
: 
: Just ignorance on my part in conjunction with being a web department of 1
: :-). I am not a schooled programmer, which I'm sure shows. Actually, after
: this site is launched, I will hopefully be taking some ASP.NET classes
: with
: the goal of converting the site over to that technology eventually.


I would suggest that you don't give up on what you're currently doing. What
Josh suggested using relies on something called "default properties" - a
feature of VB (and VB-like languages) that isn't really implemented in any
other major language. And it's the type of thing that works 90% of the time,
and trips people up the other 10% of the time.

Take the following example:

<%
objRS.ActiveConnection = objConn
%>

Did you know that what you're doing above is a Let, and assigning the value
of the *default* property of the objConn object (which is the
.ConnectionString value) to objRS.ActiveConnection? So, in effect you are
actually going to create a second connection when you call objRS.Open? The
above is the same as:

<%
Let objRS.ActiveConnection = objConn.ConnectionString
%>

On the other hand:
<%
Set objRS.ActiveConnection = objConn
%>

means that objRS.ActiveConnection actually holds a reference to the objConn
object. Which is what you want to achieve. Note the very subtle change in
syntax?

The net result: do not be seduced by the power of default properties unless
you know about them! :-)

Cheers
Ken


More information about the thelist mailing list