How much expensive openning and closing connection is when connection pool is used ???
Assume I invoke four stored procedures in a page , I open and close the connection for invoking each . How much will it affect the performance of that page ??
calling this in a page :
Connection.Open();
//Invoke the stored procedure n1
Connection.Close();
Connection.Open();
//Invoke the stored procedure n2
Connection.Close();
Connection.Open();
//Invoke the stored procedure n3
Connection.Close();
Connection.Open();
//Invoke the stored procedure n4
Connection.Close();
Is it worth replacing it with this. I have made the site like above.It is so hard for me to replace that. What is your suggestion ?
Connection.Open();
//Invoke the stored procedure n1
//Invoke the stored procedure n2
//Invoke the stored procedure n3
//Invoke the stored procedure n4
Connection.Close();
Comments
The best way is open the connection once and take as much as data you can from the database and then close the connection.
My Suggestion open the connection once, execute all the SP's and close the connection.
"Always Smile "