473,497 Members | 2,184 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Open SQL 2005 database question

Shoud a SQL 2005 database remain open in a Visual Basic program, or should
it be opened and closed in every subroutine?

Thanks for any info.
Oct 29 '07 #1
3 1310
Charlie wrote:
Shoud a SQL 2005 database remain open in a Visual Basic program, or should
it be opened and closed in every subroutine?
How often will the VB program access the database?
Oct 30 '07 #2
Charlie (ja******@yahoo.com) writes:
Shoud a SQL 2005 database remain open in a Visual Basic program, or should
it be opened and closed in every subroutine?
You don't really open or close the database, but you connect and disconnect
from the server.

It's common to do as you say open and disconnect. It's not really cheap to
open a connection to SQL Server. However, the client API maintains a
connection pool, so behind the scenes the connection is open, and is reused
when you connect anew. (If there is no connection for a certain amount of
time, typically 60 seconds, the connection is closed for real.)

Then again, in a two-tier application it's not really any major flaw to
have a global connection that you keep open.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Oct 30 '07 #3
Very frequently.

"Ed Murphy" <em*******@socal.rr.comwrote in message
news:47***********************@roadrunner.com...
Charlie wrote:
>Shoud a SQL 2005 database remain open in a Visual Basic program, or
should it be opened and closed in every subroutine?

How often will the VB program access the database?

Oct 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2101
by: Unigroup of New York | last post by:
Content-Type: multipart/mixed; boundary="------------C465DF38DCB38DD2AF7117E0" Lines: 327 Date: Tue, 15 Feb 2005 23:36:38 -0500 NNTP-Posting-Host: 24.46.113.251 X-Complaints-To: abuse@cv.net...
1
5302
by: corey_bunch | last post by:
Help! One of my main databases has been marked as suspect - the initial problem is that my disk had no space. So I moved some files, made some space, stopped & restarted the service, and now I...
3
4185
by: Chris | last post by:
Hello all. I have a database that I use to send email updates to people. Everything is working fine, but one suggestion I keep getting is to add a link to the automatic emails that will open up the...
4
2454
by: Macca | last post by:
Hi, I have an windows forms application that accesses a SQL database I have a few questions as to connecting to the database. This application will run 24 hours a day. It is a monitoring...
2
10628
by: Mr.KisS | last post by:
Hello. I'm under Windows XP PRO SP1, IIS 5.1 ans SQL SERVER 2005 Express. When i try to open a connexion with : <connectionStrings> <add name="AppCnxStr"...
2
2857
by: dennist685 | last post by:
Can't open Northwind I remembered doing walkthrough using Northwind. However it wasn't an http project but a file project using the development server. Northwind allowed me to add, edit and...
3
22862
by: Tim | last post by:
Hello, We do not run SQL Server in our shop, but I'm starting to be tasked with analyzing SQL Server databases from outside shops. I will need to open .MDF files sent to me. Can I do this using...
20
7172
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I...
2
4155
by: sqlgirl | last post by:
Hi, We have 2 servers. Server1 is a 2000 box, with SP3 (yes I know it is not up to date). Server2 is a 2005 box, SP2. I set up Server1 (2000) to have a linked server to Server2 (2005). The...
0
7120
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7373
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4583
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1405
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
286
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.