title: Column Named Cannot be Found
body: <p>I have 2 datagrid that needs to show data from 2 tables, I used 2 load table for each datagrid to show the data.</p>
  
  <pre><code>public diagnosechipcomplainprint()
  {
      InitializeComponent();
      load_table();
  }
  
  void load_table()
  {
      string query = "Select HospitalRecordNo,concat(Patient_Fname, ' ', Patient_Mname, ' ',Patient_Lname) as 'Patient Name',Age,Gender,DateOfBirth,Email,PatientContact from patientinfo;";
  
      MySqlConnection con = new MySqlConnection(connection);
      MySqlCommand com = new MySqlCommand(query, con);
  
      try
      {
          MySqlDataAdapter sd = new MySqlDataAdapter();
          sd.SelectCommand = com;
          DataTable dba = new DataTable();
          sd.Fill(dba);
          BindingSource bs = new BindingSource();
          bs.DataSource = dba;
          dataGridView1.DataSource = bs;
          sd.Update(dba);
      }
      catch (Exception ex)
      {
          MessageBox.Show(ex.Message);
      }
  }
  
  void load_table2()
  {
      string query2 = "Select VisitNo, HospitalRecordNo, DateOfVisit from visit_details where HospitalRecordNo = '" + recordno.Text + "';";
  
      MySqlConnection con = new MySqlConnection(connection);
      MySqlCommand com = new MySqlCommand(query2, con);
  
      try
      {
          MySqlDataAdapter sd = new MySqlDataAdapter();
          sd.SelectCommand = com;
          DataTable dba = new DataTable();
          sd.Fill(dba);
          BindingSource bs = new BindingSource();
          bs.DataSource = dba;
          dataGridView2.DataSource = bs;
          sd.Update(dba);
      }
      catch (Exception ex)
      {
          MessageBox.Show(ex.Message);
      }
  }
  </code></pre>
  
  <p>And when i do cell click on the first data grid the data from datagrid will show in label, but when i click on the second data grid it shows error.</p>
  
  <pre><code>private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
  {
      if (e.RowIndex &gt;= 0)
      {
          DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
          recordno.Text = 
          row.Cells["HospitalRecordNo"].Value.ToString();
          pname.Text = row.Cells["Patient Name"].Value.ToString();
          age.Text = row.Cells["Age"].Value.ToString();
          gender.Text = row.Cells["Gender"].Value.ToString();
          dateofbirth.Text = row.Cells["DateOfBirth"].Value.ToString();
          email.Text = row.Cells["Email"].Value.ToString();
          contact.Text = row.Cells["PatientContact"].Value.ToString();
      }
  }
  
  private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
  {
      if (e.RowIndex &gt;= 0)
      {
          DataGridViewRow row1 = dataGridView2.Rows[e.RowIndex];
  
          visitno.Text = row1.Cells["VisitNo"].Value.ToString();
          rec.Text = row1.Cells["HospitalRecordNo"].Value.ToString();
          dateofvisit.Text = row1.Cells["DateOfVisit"].Value.ToString();
          nurse.Text = row1.Cells["Nurse_on_duty"].Value.ToString();
          temp.Text = row1.Cells["Temperature"].Value.ToString();
          cardiac.Text = row1.Cells["Cardiac_Rate"].Value.ToString();
          respiratory.Text = 
          row1.Cells["Respiratory_Rate"].Value.ToString();
          bloodpress.Text = 
          row1.Cells["Blood_Pressure"].Value.ToString();
          weight.Text = row1.Cells["Weight"].Value.ToString();
          sat.Text = row1.Cells["02_Stat"].Value.ToString();
      }
  }
  </code></pre>
  
  <p>That is the code i used in Cellclick datagrid view 2.
  I hope you can help me. Thank you</p>