global variables in .NET: how to store a connection string and have it availablethroughout..

global variables in .NET: how to store a connection string and have it availablethroughout..

Post by Miha Marki » Sat, 06 Dec 2003 18:54:22


Hi Troy,

You should say that you are on the asp.net :)
Store it in the either Session collection (Session["key"] = value) or
Application collection (Application["key"] = value) .

--
Miha Markic - DXSquad/RightHand .NET consulting & software development
miha at rthand com

Developer Express newsgroups are for peer-to-peer support.
For direct support from Developer Express, write to XXXX@XXXXX.COM
Bug reports should be directed to: XXXX@XXXXX.COM
Due to newsgroup guidelines, DX-Squad will not answer anonymous postings.




file shows the initial value of the login name variable declared inside the
module and prompts the user to enter his own login name . how come when I
run the application in VS.NET again, the same login name last inputted shows
up, it's like the module doesn't reset it's own value.
ASP.NET resources...
 
 
 

1. Running .Net 2.0 Application without having .Net Framework ins

2. using global variables in the database connection string

Guys,

I'm sure this has been asked a million times but I can't seem to
formulate a google search that returns what i'm looking for.

I've go a dev and live environment. Currently the DB connect string is
hard coded into each php file which means i'm going to have to change
every page - Arrgh!!

If i put the DBonnect into a function and store it in an include file,
it doesn't seem to work, Also the connetion works with inline PHP
statements, but I have to repeat it in every function even if they are
in the main php file??? which doesn't seem right to me..

I need to either :-

Store the connection variables in an include file and retrieve them as
global values

OR

Store the connection string in a function in an include file which can
be accessed by all functions.

also do I really have to call the dbconnect inside every function.

Please note, if it makes any difference, I still havn't got my head
round OO programming in PHP so it is still pretty much procedural. I
am using PEAR but dont really understand (or care at the moment) about
what it is doing.

Thanks in advance

Aaron

3. Is storing connection string in a session variable a good idea?

4. Assign a variable result to a global variable in a stored DTS

5. Evaluating Global Variables Named Strings as Variables

6. Accessing add-in's global variables

7. Global Variables in Add-Ins

8. Plug-ins and state (use of global variables)

9. how to auto create a global variable with specific variable name in a global vi ?

10. DTS Global Variable - How pass a datetime, compliant to Iso 8601, as global variable?

11. Why is it not possible to assign a global variable to another global variable..?

12. Initialised global variable and unitialised global variable

13. Is static global variable the same as non static global variable ?

14. Initialize global variable before any other global variables

15. Global variable losing it's value when another button is pushe