C
Clipboard J. Spaghetti
Hello everyone,
Could you please tell me if it is appropriate to use code such as this to
generate a valid SqlConnection object for use with objects that use it?
private SqlConnection GetConnection()
{
try
{
// connection pooling means this should get reused immediately
con.Close();
}
catch(){};
con = new SqlConnection("Database=zzz;Server=X1;Trusted_Connection=Yes");
con.Open();
return con;
}
I am assuming that connection pooling means that doing a Close/Open will
be lightweight enough not to affect performance badly. Is this correct?
Thanks
Could you please tell me if it is appropriate to use code such as this to
generate a valid SqlConnection object for use with objects that use it?
private SqlConnection GetConnection()
{
try
{
// connection pooling means this should get reused immediately
con.Close();
}
catch(){};
con = new SqlConnection("Database=zzz;Server=X1;Trusted_Connection=Yes");
con.Open();
return con;
}
I am assuming that connection pooling means that doing a Close/Open will
be lightweight enough not to affect performance badly. Is this correct?
Thanks