1. In my application,to Connect to DB, i used to write direct string queries in any function, assigning them appropriate variables using '+' sign. Then I had separate Data Access class to which I used to pass this query where it used to get executed.Code was like this:
Expand|Select|Wrap|Line Numbers
- void someFunction()
- {
- clsDatabase objDB = new clsDatabase();
- strSQL = "INSERT INTO QUERY"+param1;
- objDB.ProcessQuery(strSQL);
- }
Expand|Select|Wrap|Line Numbers
- void someFunction()
- {
- clsDatabase objDB = new clsDatabase();
- objDB.functionWhichCallsStoredParameters(param1);
- }
2. Second Thing I want to know is, In one of my classes, I m making object of ClsDatabase in static method. I think its gonna use same objects again & again, creating problems for concurrency.Plz, clarify.
Expand|Select|Wrap|Line Numbers
- static void someFunction()
- {
- clsDatabase objDB = new clsDatabase();
- objDB.functionWhichCallsStoredParameters(param1);
- }
Thanks in advance.