title: How to fit multiple tables into one datagridview
body: <p>Basically I have a c# application which takes values from a textfile, stores them in lists and transfers them into SQLite tables. </p>
  
  <p>The three tables are named abc, t2, and t3 respectively.</p>
  
  <p>I want to then take those sqlite tables and present them in the c# app in datagridviews.
  So far I've been been able to transfer 1 table (table abc) to the grid view.
  <strong>I want to transfer all 3 tables to the gridview.</strong></p>
  
  <p><strong>Problem:</strong> I want to make the 3 tables appear in ONE grid but I simply don't know the syntax on how to do accomplish that.</p>
  
  <p>The following is just how the 3 tables are populated. The more important code (transferring data to grid) is below this</p>
  
  <pre><code>    // TRANSFERING VALUES TO THE SQLITE DB
  
      private void button4_Click(object sender, EventArgs e)
      {
            // We use these three SQLite objects:
            SQLiteConnection sqlite_conn;
            SQLiteCommand sqlite_cmd;
            SQLiteDataReader sqlite_datareader;
  
            // create a new database connection: // Maybe error here - video was different
            sqlite_conn = new SQLiteConnection(@"Data Source=database.db;Version=3;");
  
            // open the connection:
            sqlite_conn.Open();
  
            // create a new SQL command:
            sqlite_cmd = sqlite_conn.CreateCommand();
  
            // Let the SQLiteCommand object know our SQL-Query:
            sqlite_cmd.CommandText = "CREATE TABLE IF NOT EXISTS 'abc' (Seq text, Field text, Desc text, Len text, Dec text, Typ text, Percnt text, Pop text, Alzero text, MaxLen text );";
  
            // Now lets execute the SQL                                                                                 
            sqlite_cmd.ExecuteNonQuery();
  
            // **** SQLITE TRANSFER SECTION 1 - transfer values from list1 to table1 *****
  
            sqlite_cmd.CommandText = " DELETE FROM abc";
            sqlite_cmd.ExecuteNonQuery();
  
            sqlite_cmd.CommandText = "INSERT INTO abc (Seq, Field, Desc, Len, Dec, Typ, Percnt, Pop, Alzero, MaxLen) VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10)";
            sqlite_cmd.Parameters.AddWithValue("@p1", 6);  // dummy initial values 
            sqlite_cmd.Parameters.AddWithValue("@p2", 878); 
            sqlite_cmd.Parameters.AddWithValue("@p3", 56);
            sqlite_cmd.Parameters.AddWithValue("@p4", 6);
            sqlite_cmd.Parameters.AddWithValue("@p5", 546);
            sqlite_cmd.Parameters.AddWithValue("@p6", 565);
            sqlite_cmd.Parameters.AddWithValue("@p7", 568);
            sqlite_cmd.Parameters.AddWithValue("@p8", 526);
            sqlite_cmd.Parameters.AddWithValue("@p9", 586);
            sqlite_cmd.Parameters.AddWithValue("@p10", 526);
  
  
            for (int i = 0; i &lt; NumListValues; i += 10) // Filling SQlite table rows and columns with values from our list 
            {
                sqlite_cmd.Parameters.AddWithValue("@p1", list[i]);
                sqlite_cmd.Parameters.AddWithValue("@p2", list[i+1]);
                sqlite_cmd.Parameters.AddWithValue("@p3", list[i+2]);
                sqlite_cmd.Parameters.AddWithValue("@p4", list[i+3]);
                sqlite_cmd.Parameters.AddWithValue("@p5", list[i+4]);
                if (i &gt; 490)
                    break; 
                sqlite_cmd.Parameters.AddWithValue("@p6", list[i+5]);
                sqlite_cmd.Parameters.AddWithValue("@p7", list[i+6]);
                sqlite_cmd.Parameters.AddWithValue("@p8", list[i+7]);
                sqlite_cmd.Parameters.AddWithValue("@p9", list[i+8]);
                sqlite_cmd.Parameters.AddWithValue("@p10", list[i+9]);
                sqlite_cmd.ExecuteNonQuery();
  
            }
  
            //   **** SQLITE TRANSFER SECTION 2 - transfer values from list2 to 2nd table *****
  
            sqlite_cmd.CommandText = "CREATE TABLE IF NOT EXISTS 't2' (YYMM text, MinDate text, MaxDate text, TotalTrans text, DebitTrans text, AMOUNTINDOCUMENTCURREN text );";
  
            sqlite_cmd.ExecuteNonQuery();
  
            sqlite_cmd.CommandText = " DELETE FROM t2";
            sqlite_cmd.ExecuteNonQuery();
  
            sqlite_cmd.CommandText = "INSERT INTO t2 (YYMM, MinDate, MaxDate, TotalTrans, DebitTrans, AMOUNTINDOCUMENTCURREN ) VALUES (@b1, @b2, @b3, @b4, @b5, @b6)";
            sqlite_cmd.Parameters.AddWithValue("@b1", 6);  // dummy initial values 
            sqlite_cmd.Parameters.AddWithValue("@b2", 878); 
            sqlite_cmd.Parameters.AddWithValue("@b3", 56);
            sqlite_cmd.Parameters.AddWithValue("@b4", 6);
            sqlite_cmd.Parameters.AddWithValue("@b5", 546);
            sqlite_cmd.Parameters.AddWithValue("@b6", 565);
  
           for (int i = 0; i &lt; NumList2Values; i+= 6) // Filling SQlite table rows and columns with values from list2
           {
               sqlite_cmd.Parameters.AddWithValue("@b1", list2[i]);
               sqlite_cmd.Parameters.AddWithValue("@b2", list2[i+1]);
               sqlite_cmd.Parameters.AddWithValue("@b3", list2[i+2]);
               sqlite_cmd.Parameters.AddWithValue("@b4", list2[i+3]);
               sqlite_cmd.Parameters.AddWithValue("@b5", list2[i+4]);
               sqlite_cmd.Parameters.AddWithValue("@b6", list2[i+5]);
               sqlite_cmd.ExecuteNonQuery();
           }
  
  
  
          // Create table to transfer values from list 3
  
         sqlite_cmd.CommandText = "CREATE TABLE IF NOT EXISTS 't3' (YYWW text, MinDate text, MaxDate text, TotalTrans text, DebitTrans text, AMOUNTINDOCUMENTCURREN text );";
  
         sqlite_cmd.ExecuteNonQuery();
  
         sqlite_cmd.CommandText = " DELETE FROM t3";
         sqlite_cmd.ExecuteNonQuery();
  
         sqlite_cmd.CommandText = "INSERT INTO t3 (YYWW, MinDate, MaxDate, TotalTrans, DebitTrans, AMOUNTINDOCUMENTCURREN ) VALUES (@c1, @c2, @c3, @c4, @c5, @c6)";
         sqlite_cmd.Parameters.AddWithValue("@c1", 6);  // dummy initial values 
         sqlite_cmd.Parameters.AddWithValue("@c2", 878); 
         sqlite_cmd.Parameters.AddWithValue("@c3", 56);
         sqlite_cmd.Parameters.AddWithValue("@c4", 6);
         sqlite_cmd.Parameters.AddWithValue("@c5", 546);
         sqlite_cmd.Parameters.AddWithValue("@c6", 565);
  
         for (int i = 0; i &lt; NumList3Values ; i+= 6) // Filling SQlite table rows and columns with values from list2
         {
             sqlite_cmd.Parameters.AddWithValue("@c1", list3[i]);
             sqlite_cmd.Parameters.AddWithValue("@c2", list3[i+1]);
             sqlite_cmd.Parameters.AddWithValue("@c3", list3[i+2]);
             sqlite_cmd.Parameters.AddWithValue("@c4", list3[i+3]);
             sqlite_cmd.Parameters.AddWithValue("@c5", list3[i+4]);
             sqlite_cmd.Parameters.AddWithValue("@c6", list3[i+5]);
             sqlite_cmd.ExecuteNonQuery();
  
         }
  </code></pre>
  
  <p><strong>The following is how I populate the datagrid with values from the first table</strong></p>
  
  <pre><code>       string sql = " SELECT * FROM abc";
         SQLiteDataAdapter da;
         DataTable dt;
  
         sqlite_cmd.CommandText = sql;
  
         //Create New Datatable to fill with data
         dt = new DataTable();
  
         //Create DataAdapter to fill data in DataTable via Adapter
         da = new SQLiteDataAdapter(sql, sqlite_conn);
         da.Fill(dt);
  
         // Lets populate the datagrid
         dataGridView1.DataSource = dt;
         dataGridView1.Refresh();
  </code></pre>