Hi,
I developed a software for Restaurant, so I need to run multiple instance of a form(Billing form) concurrently.
I created a
Class "Data_Con" for Database connection and manipulation (Insert, Update and Delete Rocords),Its has a constructor parameter which take the database path. This class used in every forms as a global variables,and initialize that object in form constructor...
Its going fine upto 10 or 12 Instance of form creation, but after that its given an error(error showing in message Box)
Unspecified Error
.After that error was occurred, It's show on every time when any form is opening, mainly after the error that forms codes are not working(like its not getting data from database)..
My form constructor code is :-
public NewBill(string para,Form1 mainFrm)
{
InitializeComponent();
MF = new MiscFunction();
DC = new Data_Con(Application.StartupPath);
menu = new Data_Con(Application.StartupPath);
Auth = new Data_Con(Application.StartupPath);
menuRate = new Data_Con(Application.StartupPath);
itemEntry = new Data_Con(Application.StartupPath);
NTW = new NumToWord();
ParaValue = para;
mdiFrm = mainFrm;
}
Code is Constructor of "Data_Con" :
public Data_Con(string path)
{
try
{
conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + path + "\\MrityunData.accdb;Jet OLEDB:Database Password=power;");
conn.Open();
adpt = new OleDbDataAdapter("select * from Bill_details", conn);
dataSet = new DataSet();
cmd = new OleDbCommand();
}
catch(Exception e) {
MessageBox.Show(e.Message);
}
}
Here You can see I created multiple object of
"Data_Con" Class,the error show on every Object Initialization(5 times).
How to solve that error??
thanks in advanced...
Regards
Jayanta..