Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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
  #1 (permalink)  
Old January 7th, 2005, 12:25 PM
Authorized User
 
Join Date: Dec 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default global variable?

hey there'
does anybody know if asp can declare like "global" variable? so it can use anywhere in one webpage
like php did. thx,nb: please write down the coding.

  #2 (permalink)  
Old January 7th, 2005, 08:07 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Two options come to mind:
1..Constant (use if the value never changes)
   CONST someName = someValue

2..Session variable (you may change this value)
   session("someName") = someValue

Wind is your friend
Matt
  #3 (permalink)  
Old January 7th, 2005, 10:21 PM
Friend of Wrox
 
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

If you are looking for application level global variable then .. make use of Application Variable:

Application("ConnectionString") = connectionString

This value would be accessible from all the pages within your application.

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
  #4 (permalink)  
Old January 8th, 2005, 06:50 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

FYI: A 'global variable' in PHP is equivalent to a session level variable in ASP

If you are to go down the 'application' road be sure to research what a global.asa file is

Wind is your friend
Matt


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to declare the global variable in global.asax? calyn_gately ASP.NET 3.5 Basics 0 August 6th, 2008 08:06 PM
comapring global variable value to local variable amhicraig XSLT 6 December 5th, 2007 12:16 PM
Global Variable techfreak123 XSLT 0 August 3rd, 2006 07:45 AM
global variable melvik C# 37 March 2nd, 2005 02:07 PM
global variable in c# kobystud C# 3 April 22nd, 2004 05:56 AM





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