Connection object in a application variable

Bodybag

Regular
Joined
Jan 16, 2004
Messages
75
What would happen if i stored a open connection object in a application variable and made it the only connection that i use.Would it improve performance.Crash out. Become terribly slow. Just an idea.
 
You should really be using connection pooling. Create a new connection each time you need one using the exact same connection string. When you're finished with it, dispose it and the pool will do the rest for you.

Don't keep the same connection constantly open because you'll have problems with multiple datareaders trying to use it simultaneously and throwing an exception.
 
I am using connection pooling currently. I don't like using datareader.I prefer Datatables. I was just wondering if this would actualy work.
 
Back
Top