Good call. I completely overlooked that part
----- Tom Krueger wrote: ----
Hello
Something to keep in mind is that the connection pooling does NOT work i
you are using windows integerated security. Connection pooling reguire
that the exact connection string is used to connect each time, however, whe
using windows integrated security something happens under the cover tha
does not allow for pooling
I open and close the connection basically every method and rely on th
connection pooling. However, if you would rather not you could store th
connection as static in a Global class. Forinstance Global.GetConn(); I
you do this, remember that your application will not scale well as mor
users are connecting at the same time and you may run out of allowe
connections
private static SqlConnection _conn
public static SqlConnection GetConn()
if (_conn != null && _conn.State != SqlConnectionState.Open())
_conn.ConnectionString = ..
_conn.open()
return _conn
Note: this code may not be perfect, but it is close
Take Care
Tom Kruege
Blue Pen Solution
http://www.BluePenSolutions.co
Suresh said:
(Assuming you are SQL server is your data store
kind of global object... But why would you want to do that? Have yo
noticed any performance problemsopening a new brand connection, instead it's using an already ope
connection from the connection pool. Also when you close a SQLConnectio
it's not actually being closed, instead it's released back to the pool to b
re-used