TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Shishu Singh
NA
69
1k
Regarding Connection pooling
Jan 19 2018 6:21 AM
Hi All,
Please guide me.
SqlConnection con = new SqlConnection();
con.ConnectionString = conn + "Connection Timeout=30;Connection Lifetime=0;Min Pool Size=0;Max Pool Size=1;Pooling=true;integrated security=true";
SqlCommand cmd = new SqlCommand("Storeprocedure", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Action", "Select");
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
Grd1.DataSource = dr;
Grd1.DataBind();
con.Close();
In the above code i configure max pool size is 1 and every time i open and close the conection If i not closing the connection ,during reload binding grid again it wil reached out of the max pool size.
If i using open and close connection each time then the things becomes same that take more time consuming, what benefit of connection pooling.
Please guide me if i not closing the connection then how its beneficial and not reached out of the max pool size.
Thanks in advance
Reply
Answers (
2
)
Object reference not set to an instance of an object
How to convert Boolean value to int and int to bool C#