Raju Dhiman

Raju Dhiman

  • 1.8k
  • 56
  • 1.3k

ExecuteReader requires an open and available Connection

Jul 4 2018 1:41 PM

SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Select netfee From Admissions";
cmd.Connection = con;
SqlDataReader dr1 = cmd.ExecuteReader();
{
if (dr1.Read())
{
TextBox1.Text = dr1[0].ToString();

}

}
dr1.Close();
con.Close();
cmd.Dispose();
 
Plzz Solve error