المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to keep data available for whole project access?



C# Programming
09-24-2011, 03:51 PM
Well. I have done a small project.

But the problem is some of my required data is not available across whole project.

I mean, every time I go form to form I need to open the database and fill the same data from the same SqlDataAdapter.

Instead is it possible to keep the data somewhere globally for all the project forms?

With my project I have a class for the queries and tables and wherever I need data in the forms, there I use to call the Subs for filling the table like the below...
Class1.cs ========= public void MyTableFill(){ Con.ConnectionString = Con_1; Con.Open(); SQLDAp = new SqlDataAdapter(MyQry, Con); SQLDAp.Fill(MyTable); Con.Close(); } Form1.cs ======== Class1 MyDatas = new Class1(); Form1_Load() { MyDatas.MyTableFill(); } Form2.cs ======== Class1 AccDatas=new Class1(); Form2_Load() { AccDatas.MyTableFill(); }Thankshttp://www.barakasoft.com/script/Forums/Images/thumbs_up.gif