Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool.
i have too many buttons on my page and each button have similar kind of code, on executing five-seven click works fine, but after that it gives above error, i found on net that connection is not close, but i not find any error on my code please help me.
Label11.Text = "" + Session["delears_Email"];
Label12.Text = "" + Session["delears_id"];
string cs = ConfigurationManager.ConnectionStrings["steel@bajaarConnectionString"].ConnectionString;
conn = new SqlConnection(cs);
cmd = new SqlCommand("select Delears_Email,Delears_password from Delears_angle;");
cmd.Connection = conn;
try
{
conn.Open();
dr = cmd.ExecuteReader();
while (dr.Read())
{
if (Label11.Text == dr.GetString(0) && Label12.Text == dr.GetString(1))
{
Label2.Text = "Angle";
}
else
{
Label2.Text = "";
}
}
}
catch (SqlException ee)
{
Label3.Text = ee.Message + "";
conn.Close();
}
catch (NullReferenceException w)
{
Label3.Text = w.Message + "";
conn.Close();
}
is my connection is not close?