where can i declare a global variable ?
-
Hi , please i have a small problem right here , i need to declare a connection & a dataset & also an adapter variables within ma application but i want to use just 1 variable in those ones in each session that mean all the pages in 1 session will use 1 variable that mean this variable havs to be public or global or i don't know , i just tried to declare it in the module in vs2003 but in the web devoloper 2005 there is no module item , even with that module it doesn't work can somebody help me ?
try to be good if you can't be the best
-
Hi , please i have a small problem right here , i need to declare a connection & a dataset & also an adapter variables within ma application but i want to use just 1 variable in those ones in each session that mean all the pages in 1 session will use 1 variable that mean this variable havs to be public or global or i don't know , i just tried to declare it in the module in vs2003 but in the web devoloper 2005 there is no module item , even with that module it doesn't work can somebody help me ?
try to be good if you can't be the best
Store your variable in session state. After retreiving the variable from session state you can pass it as an arguement to whatever method / function you want. You need to read up on ASP.Net development. Check these links for more info. http://msdn.microsoft.com/msdnmag/issues/05/09/SessionState/default.aspx http://msdn.microsoft.com/asp.net/learning/learn/newtodevelopment/
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things --thedailywtf 3/21/06
-
Hi , please i have a small problem right here , i need to declare a connection & a dataset & also an adapter variables within ma application but i want to use just 1 variable in those ones in each session that mean all the pages in 1 session will use 1 variable that mean this variable havs to be public or global or i don't know , i just tried to declare it in the module in vs2003 but in the web devoloper 2005 there is no module item , even with that module it doesn't work can somebody help me ?
try to be good if you can't be the best
-
Why do you think that you need that? Session state is not a very good place for database objects. Declare them where you use them.
--- b { font-weight: normal; }
well, if i declare them when i use them then i can't use one coonnection in all my pages , i will create 1 connection for each page or at leat to reinitialize the same connection in all the pages but what i wantis to declare it once do you have a suggestion
try to be good if you can't be the best
-
Hi , please i have a small problem right here , i need to declare a connection & a dataset & also an adapter variables within ma application but i want to use just 1 variable in those ones in each session that mean all the pages in 1 session will use 1 variable that mean this variable havs to be public or global or i don't know , i just tried to declare it in the module in vs2003 but in the web devoloper 2005 there is no module item , even with that module it doesn't work can somebody help me ?
try to be good if you can't be the best
-
. . . public partial class MyPage: System.Web.UI.Page { public SqlConnection sqlConn = new SqlConnection(); public DataSet ds = new DataSet(); public SqlDataAdapter sqlAdapter = new SqlDataAdapeter(); . . . . . }
this doesn't do the jojb i tried exactlly this code with public visibility but it doesn't work any ideas ?
try to be good if you can't be the best
-
well, if i declare them when i use them then i can't use one coonnection in all my pages , i will create 1 connection for each page or at leat to reinitialize the same connection in all the pages but what i wantis to declare it once do you have a suggestion
try to be good if you can't be the best
To use one connection for all pages is a really REALLY bad idea. The result is one (or more) of these: :: Only one user at a time can use the site, as the connection will be busy. :: You will get conflicts when more than one request uses the same connection. :: If you use one connection per user, the number of users can never be more than the number of simultaneous connections that the database accepts. :: The connection will time out and close automatically after a few minutes.
--- b { font-weight: normal; }