title: fill grid view in c#
body: <p>I am new in using visual studio and ADO.NET. I want to display result from sqlserver database in data gridview. </p>
  
  <p>This is my code but it does not fill data to  gridview.                </p>
  
  <pre><code>private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
          {
  
  
              SqlConnection con = new SqlConnection();
              SqlCommand Cmd = new SqlCommand("sp_Expert_person", con);
              con.Open();
              Cmd.CommandType = CommandType.StoredProcedure;
              Cmd.Parameters.Add("@takhasos", SqlDbType.VarChar).Value = comboBox1.SelectedText;
              SqlDataAdapter da = new SqlDataAdapter(Cmd);
              SqlCommandBuilder commandBuilder = new SqlCommandBuilder(da);
              DataTable dt = new DataTable();       
  
              da.Fill(dt);
              SqlDataReader reader = Cmd.ExecuteReader();
              dt.Load(reader);
              dataGridView1.DataSource = dt;
              this.dataGridView1.Visible = true;
              dataGridView1.DataSource = dt;
  
          } 
  </code></pre>