borderAndreaVB free resources for Visual Basic developersborder

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincani

AndreaVB Home | News Home | Forum Home | Downloads | Register | Search | PM | Profile

Previous Topic (Run Time Population of a DBGrid Thru Recordset)Next Topic (sql connection string) New Topic Post Reply
AndreaVB OnLine : Database : connection a BD??
Poster Resource
walterjpv
Level: Guest

icon connection a BD??


Hi everybody!

i have a doubt:
i use VB60 and SQL Server. What is the better way?
1. i  open and close the conection to the DB when i want to query, insert or update a register in the DB.

or

2. i open the conection since the system starts and close it when the system ends

what method is the best one?

Regards

Walter

03-09-2002 at 08:54 PM
| Add Comment
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1658
icon Re: connection a BD??

Depends on a lot of things (like # of users) but perhaps the "most" important factor is this: how often is the database being used?

For example, if the DB is used only for a few starting values, and a query every so often - the program can do most features without the SQL, then disconnect after running a query.

If, however, the program mainly displays the results from queries, and doesn't really do anything on it's own (ie: no SQL, program's useless) then maintain the connection from first use to last.

Of course you could put an "inactivity disconnect" routine in the program - disconnect after x minutes/seconds.

And it also depends on how many users you can have connected at a time to the SQL server, if it's only 5-10 and you have 50+ users...

Generally, establishing a connection to the server, while only a few seconds (or msec), will increase the program's run time. SQL Servers do disconnect users after long periods (some at least).

03-09-2002 at 10:59 PM
View Profile Send Email to User Show All Posts Visit Homepage | Add Comment
AndreaVB OnLine : Database : connection a BD??
Previous Topic (Run Time Population of a DBGrid Thru Recordset)Next Topic (sql connection string)New Topic Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder