?
Solved

Database Connection

Posted on 2014-09-09
4
Medium Priority
?
173 Views
Last Modified: 2014-09-09
Experts, just a quick question. I am about to start work on an application and was just wondering about good practices. I will use an Access database with my application. The question I have with regards to the connection should I open the connection in a module and make it public so that all forms and classes can access it and then close the connection when the application closes? Or should I create the connection within each form or class and then close the connection with the form is closed or the class is disposed of? Or does it make any difference.
0
Comment
Question by:Basicfarmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Jerry Miller earned 2000 total points
ID: 40313248
From the .Net side, you should normally only keep the connection open while you are accessing it and close it when that operation is complete. Databases only have a limited number of connections and each query would use it's own connection and you would quickly no longer be able to connect from the application.

See this about ADO.net connections, they use an Access database. It should help you. Please don't be offended by the title, it was simply a good read.

http://www.codeproject.com/Articles/8477/Using-ADO-NET-for-beginners
0
 

Author Closing Comment

by:Basicfarmer
ID: 40313253
Thanks Jerry....
0
 
LVL 18

Expert Comment

by:Jerry Miller
ID: 40313255
But if you are building an application that is going to get much use or needs to grow in the future, I would look at using a database and not Access. It is good for single user, low data type apps, but anything that needs to hold more than 1 or 2GB needs to be somewhere else (MS SQL, MY SQL, Oracle, etc.)
0
 

Author Comment

by:Basicfarmer
ID: 40313260
I will look into those. Thanks... Reading the article now...
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question