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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection Type

Status
Not open for further replies.

applek

Programmer
Nov 18, 2002
15
US
Hi.

Regarding to the performance factor, which type of connection should we adopt if using SQL server:

1. Set a connection once at run time, exit it when eixt the whole application

2. Set a connection on a specified time, exit it when exit a certain function/procedure. Thus, it has to set another new connection for the next function/procedure.

Besides, is there any trade-off if i applied the second method? I have to use the second method since i have encountered:

Run-time error: 3709
The connection cannot be used to perform this operation. It is either closed/invalid in this context.

This error happened when i used the first method and until i do again the 'select' statement, it cause me this error.

Does anybody have the idea?
 
Make the connection variable a global variable, and keep it seprate in a module. Also intitiate the connection at the main form's load, and make in nothing in the applications' exit routine. you can't use a private variable to set the connection if u r following the first method.

Module.

Global GL_Cn as ADODB.Connection

All the best All the Best
Praveen Menon
pcmin@rediffmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top