I am relatively new to C# and OOP, and I have a question about good programming practice regarding database connections. I am writing a program in which multiple forms will be connecting to a singular Access database. I have the OleDbConnection setup and working.
My question is: What is the best way to handle the database connection between forms?
1. Should I pass the connection as a parameter between the forms? If so, is it OK to leave it open?
-or-
2. Should I create a new connection each time a form is created that uses the database?
Thanks!
--Brad
My question is: What is the best way to handle the database connection between forms?
1. Should I pass the connection as a parameter between the forms? If so, is it OK to leave it open?
-or-
2. Should I create a new connection each time a form is created that uses the database?
Thanks!
--Brad