Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear i m using login panel for different department .

Master admin than Department Using . there are one designation Section Like Level one , Level two , level three .

when i login than store value from data base but problem is this . when new form is openning than i m unable to use than login base value from data base.

con.open();
SqlCommand str = new SqlCommand("Select * from Admin where LoginId = '"+LoginId.text.toString +"' ",con);
SqlAdapter adp = new SqlAdapter(str);
DataTable dt = new DataTable(asp);
con.close();

here i want stor Levele Id , Name Of Employee One Id On The base of LoginId in New Form .
Posted

1 solution

In, .NET, there are no "global variables". And this is good: they are not really needed and are potentially dangerous; using them indicates bad style. In .NET, everything has its context.

The closest concept would be the Singleton pattern, but even it should be used rarely, when it is really beneficial. You did not explain a single convincing reason for that. Please read about it:
http://en.wikipedia.org/wiki/Singleton_pattern[^].

And I saw a number of bad implementations of the pattern. A good one in C# can be found here: http://csharpindepth.com/Articles/General/Singleton.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900