Best practices coding takes avantage of the ADO.NET connection pool, which is
usually a lot better at handling connections than any code you or I could
write.
The pattern is as follows:
1) Use the same connection string
2) Open the connection immediately before you use it.
3) Close the connection (and call Dispose on the Command) immediately after
using it.
This allows your connection objects to return to the ADO.NET connection pool
automatically, and they can be resurrected quickly and efficiently whenever
you need them again.
Peter
--
Site:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
Short urls & more:
http://ittyurl.net
"weird0" wrote:
> Can i create Command,Connection objects once inside a class
> constructor and use them again and again by changing their values and
> destroy them instead of creating objects everytime in a class member
> function.......
>
>