title: How to search data in database and add it to textboxes in C#?
body: <p>I have multiple <em>data</em> in <code>database</code> so i need to <em>add</em> them in different <code>textBoxes</code>.
  here is my code</p>
  
  <pre><code>private void Search_button1_Click(object sender, EventArgs e)
  {
      string query = string.Empty;
      if (ID_textBox1.Text.Trim().Length &gt; 0)
      {
          try
          {
              query = "SELECT ProductName,ProductDescription,SellPrice FROM Table2 WHERE ProductID='" + ID_textBox1.Text + "'";
              SqlConnection Conn = CreateConnection.create_connection();
              SqlCommand cd = new SqlCommand(query, Conn);
              SqlDataReader reader = cd.ExecuteReader();
  
              while (reader.Read())
              {
                  Name_textBox2.Text = reader["ProductName"].ToString();
                  Description_textBox3.Text = reader["ProductDescription"].ToString();
                  Unit_Price_textBox5.Text = reader["SellPrice"].ToString();
              }
              reader.Close();
              Name_textBox2.Text = Name_textBox2.Text;
              Description_textBox3.Text = Description_textBox3.Text;
              QTY_textBox4.Text = 1.ToString();
              Unit_Price_textBox5.Text = Unit_Price_textBox5.Text;
              Price_textBox6.Text = (decimal.Parse(QTY_textBox4.Text) * decimal.Parse(Unit_Price_textBox5.Text)).ToString();
  
          }
  
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
      }
  }
  </code></pre>