Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best Practice? 1

Status
Not open for further replies.

MadJock

Programmer
May 25, 2001
318
GB
Folks,

I have written an ASP page that connects to SQL Server. I have two versions of the page and am unsure which one is best practice. There can be a significant pause between each part of the execution.

Version 1

open connection
perform query
perform query
perform several queries
write record
close connection

Version 2

open connection
perform query
close connection
open connection
perform query
close connection
open connection
perform several queries
close connection
open connection
write record
close connection


Any advice appreciated as always,

Graeme

website:
 
I'm not sure what first one is doing but there is no need to keep closing a connection until you've finished with the database

gsc1ugs gsc1ugs
"Cant see wood for tree's...!"
 
As long as you update after each query

gsc1ugs gsc1ugs
"Cant see wood for tree's...!"
 
My basic question is - what is creates a lighter load on the server -

a) One lengthy connection with light use
b) Lots of short connections

My application in theory could be accessed by hundreds of users.

Thanks,

Graeme
website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top