Chad, I'm new to C# and OO so please forgive my ignorance but when the
connection string can change based on the user's requirements, how do you set
Global.DBConnStr? I mean, I can store the connection string in a flatfile or
XML file but I don't want to read from a file everytime I have to get the
connection string. What's the best way to handle this or am I just so
ignorant that I'm not following you? thanks, Johnny
"Chad Z. Hower aka Kudzu" wrote:
=?Utf-8?B?Sm9obm55?= <Jo****@discussions.microsoft.com> wrote in
news:53**********************************@microsof t.com: What is the best to pass a connection string around within an
application. For instance, if you have a static connection string that
is determined at login, how do you persist the connection string so that
each call to the database uses the same connection string without having
to hard code it?
I declare a static member in a class called Global and use that.
class Global {
public static string DBConnStr;
Then you can just do:
Global.DBConnStr = "xxxx";
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/