Question on how to use ADO.Net with hobby application i am writing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All;

I'm currently building an application as a hobby/learning experience for
keep track of different types of collections i have. the app is SDI but would
have multiple tabbed panes, dataviews and controls that i am creating. the
back end of the app is an access database. many of the different controls i
am creating rely on data from the DB. i am at the stage where i need to
decide how to setup the DB connections. here is my question(s).
is it better to have one persistant connection for the length of time that
the app runs and pass it to every control?.... or
is better to open and close the conection every time i need to and let each
control handle it's own connections?.... or
create a DB class that handles all the DB processing and just instatiate a
new object for each control.

ANy help would be very appreciated.
 
If it is a hobby, it doesn't really matter, but puristically speaking here
are my views.

a) It is better to open and close connections when you need them instead of
a global instance.
b) It is better to abstract all that out into a db class which acts as your
data layer.

- Sahil Malik [MVP]
Upcoming ADO.NET 2.0 book - http://tinyurl.com/9bync
 
Back
Top