Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2003, 12:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default Constant Question

Dear All,
    I've got a Constant defined as a base URL, and am trying to use that in conjunction with some filenames to create other constants as follows :

Const BaseURL="http://www.greggriffiths.org/images/"
Const NewImg=BaseURL & "new.gif"

For some reason I get an error on the second line, even though I am using a Constant and not a Variable to create the second Constant. Has anyone got a workaround to this, apart from using Variables for NewImg ?
__________________
All the best

Greg
------------------
Greg Griffiths
Web & Livelink Developer
http://www.greggriffiths.org
 
Old June 30th, 2003, 06:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is one of the things that bugs me about VBScript. Basically I don't think that there is a workaround other than using variables. Of course if anyone knows of one I am very keen to hear about it.

The way I read it is that VBScript demands that constants are not made up of other constants. In other words the compiler is too lazy to check if the word you included as part of the constant is actually a constant rather than a variable or function.

This really bugs me, particularly when you compare it to the kind of stuff you can do in C and C++ with #define.

regards
David Cameron
 
Old July 1st, 2003, 08:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

I know the feeling, oh well, I guess I'll have to use Variables and take the chance then, hoped I wouldn't have to, but expected I might.





Similar Threads
Thread Thread Starter Forum Replies Last Post
constant reference in C#? texasraven C# 19 December 13th, 2007 08:28 AM
A constant value is expected dcct84 C# 2 October 1st, 2007 09:08 AM
Constant in VBScript savoym VBScript 2 May 18th, 2005 06:53 AM
Static vs constant stoneman Access 2 December 10th, 2003 09:12 PM
Backend as a constant Steven Access 1 June 29th, 2003 11:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.