suggections for better database connectivity

  • Thread starter Thread starter Lal
  • Start date Start date
L

Lal

Dear All,

I am seeking a valid suggestions from your side regarding the sql server
performance.
my connection object get initialized at the time of login. I remain
connected throu out the session that is I do not close the connection object
on whole programmed on run time. what are your suggestions should I open and
close the connections while interacting with the database or I should use
the same connection object thru-out the project which was initialize at the
login time.
I am using multiple databases and my program working with multiple locations
also.

kindly give a good suggestion.

Thanks and Regards


K R Lal
 
Hi Lal,

I wouldn't leave the connection op the entire time, I would only open and
close it when you need it, and you're connection will be pooled so you don't
have to worry about opening and closing to much connections because .net
will get the connection from the pool. So I'd create a connection object at
login and then use that object during the entire program, but only open it
when I need it (don't forget to close it ofcourse)

greetz Peter
 
Lal,

Your question and the answer on that for SQL server is given often in this
newsgroups.

Create them as soon as you need the connection and dispose (2002/2003) them
as soon as you don't need it.

Most important reason the connection pooling.

Cor
 
Lal,

Before my message is misunderstood because of the answer from Peter.
My message means not keeping it open.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top