title: How to get value from database to a label?
body: <p>I have a table from a database, i want display a value from table to my label1. This is my code:</p>
  
  <pre><code>string query="Data Source=Bun; user Id=sa; Password=sa; Initial Catalog=eBilling;";
  SqlConnection con = new SqlConnection(query);
  con.Open();
  string query1 = "select prodName from ProductMaster where @name='Bar Counter' ";
  SqlCommand cmd = new SqlCommand(query1, con);
  
  SqlDataReader dr = cmd.ExecuteReader();
  while (dr.Read()) {
  
     label1.Text = dr.GetValue(1).ToString();
     textBox1.Text = dr.GetValue(0).ToString();
  }
  </code></pre>
  
  <p>but after that, i must click on this label to display the value. What can i do with this code to display my value in label while don't need click to anything?</p>