Click here to Skip to main content
15,897,291 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionconnection not getting closed Pin
balakpn7-Mar-07 23:38
balakpn7-Mar-07 23:38 
AnswerRe: connection not getting closed Pin
Colin Angus Mackay8-Mar-07 0:02
Colin Angus Mackay8-Mar-07 0:02 
GeneralRe: connection not getting closed Pin
balakpn8-Mar-07 3:47
balakpn8-Mar-07 3:47 
GeneralRe: connection not getting closed Pin
Dave Kreskowiak8-Mar-07 4:27
mveDave Kreskowiak8-Mar-07 4:27 
GeneralRe: connection not getting closed Pin
balakpn8-Mar-07 17:22
balakpn8-Mar-07 17:22 
AnswerRe: connection not getting closed Pin
Daytona_6758-Mar-07 17:23
Daytona_6758-Mar-07 17:23 
GeneralRe: connection not getting closed Pin
balakpn8-Mar-07 18:02
balakpn8-Mar-07 18:02 
GeneralRe: connection not getting closed Pin
Daytona_6759-Mar-07 10:23
Daytona_6759-Mar-07 10:23 
Depends on how you are using the connection really - I find that if I am using a database connection that I know that has the potential for more than a few transactions I'd think about how I am opening and closing those connections.

What I used todo is open and close a connection on each transaction to the database. This worked fine in most test cases, but as Colin mentioned, it takes time. So as insert would open the connection, do it's stuff and then close. Problem I found was that even though the connection string was exactly the same I'd be creating something like 20 connections into the database for the one instance of the application. Maybe it was something dodgy in my code (most likely)!

When you need to update records in the thousands or millions, this is just really in-efficient.

Then I went to opening the connection when the class used to represent the database (in a nutshell) was instaniated, then closed in the destructor. This works fine now and even in a tiered architecture (albeit with some changes) it generally scales quite well.
QuestionSystem Date Pin
JonCox7-Mar-07 23:36
JonCox7-Mar-07 23:36 
AnswerRe: System Date Pin
andyharman8-Mar-07 2:40
professionalandyharman8-Mar-07 2:40 
AnswerRe: System Date Pin
The ANZAC8-Mar-07 9:41
The ANZAC8-Mar-07 9:41 
AnswerRe: System Date Pin
Member 38798818-Mar-07 17:59
Member 38798818-Mar-07 17:59 
GeneralRe: System Date Pin
JonCox9-Mar-07 8:48
JonCox9-Mar-07 8:48 
QuestionStructuere with WithEvents members Pin
Marc Soleda7-Mar-07 22:48
Marc Soleda7-Mar-07 22:48 
AnswerRe: Structuere with WithEvents members [modified] Pin
TwoFaced7-Mar-07 23:15
TwoFaced7-Mar-07 23:15 
QuestionHow can I draw a line in designer? Pin
NanaAM7-Mar-07 22:37
NanaAM7-Mar-07 22:37 
AnswerRe: How can I draw a line in designer? Pin
TwoFaced7-Mar-07 23:29
TwoFaced7-Mar-07 23:29 
GeneralRe: How can I draw a line in designer? Pin
NanaAM8-Mar-07 1:37
NanaAM8-Mar-07 1:37 
QuestionMenu bars based on users............. Pin
Member 38798817-Mar-07 22:11
Member 38798817-Mar-07 22:11 
AnswerRe: Menu bars based on users............. Pin
haggenx8-Mar-07 8:25
haggenx8-Mar-07 8:25 
GeneralRe: Menu bars based on users............. Pin
Member 38798818-Mar-07 17:13
Member 38798818-Mar-07 17:13 
AnswerRe: Menu bars based on users............. Pin
Jelle Stokroos8-Mar-07 10:15
Jelle Stokroos8-Mar-07 10:15 
GeneralRe: Menu bars based on users............. Pin
Member 38798818-Mar-07 17:07
Member 38798818-Mar-07 17:07 
AnswerRe: Menu bars based on users............. Pin
Jelle Stokroos9-Mar-07 5:59
Jelle Stokroos9-Mar-07 5:59 
GeneralRe: Menu bars based on users............. Pin
haggenx9-Mar-07 7:31
haggenx9-Mar-07 7:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.