title: displaying data from multiple tables in datagridview
body: <p>I have a list of tables in one column n checkboxes in another column. I want to view data of the tables which I select by clicking on the checkboxes</p>
  
  <p>My code is</p>
  
  <pre><code>        for (int i = 0; i &lt; dataGridView2.Rows.Count; i++ )
          {
              if (dataGridView2.Rows[i].Cells[1].Value != null)
              {
                  if ((Boolean)dataGridView2.Rows[i].Cells[1].Value == true)
                  {
                      try
                      {
                          string myConnection="datasource=localhost;database=dmrc;port=3306;username=root;password=root";
                          MySqlConnection myConn = new MySqlConnection(myConnection);
                          string query = "select * from dmrc." + dataGridView2.Rows[i].Cells[0].Value.ToString();
                          MySqlCommand cmdDatabas = new MySqlCommand(query, myConn);
                          MySqlDataAdapter myDataAdapter = new MySqlDataAdapter();
                          myDataAdapter.SelectCommand = cmdDatabas;
                          DataTable dbdataset = new DataTable();
                          myDataAdapter.Fill(dbdataset);
                          BindingSource bSource = new BindingSource();
                          bSource.DataSource = dbdataset;
                          f1.dataGridView1.DataSource = bSource;
                          myDataAdapter.Update(dbdataset);
                          f1.Show();
                      }
                      catch (Exception ex)
                      {
                          MessageBox.Show(ex.Message);
                      }
                  }
              }
  </code></pre>
  
  <p>But each time it shows the data of 1 table only. What should I change and where..?</p>