title: Update TableAdapter from multiple/joined tables in a DataGridView
body: <p><code>Dynamic SQL generation is not supported against multiple base tables.</code> <br/><br/>
  Occurs when updating multiple &amp; joined tables in a <code>DataGridView</code> using <code>SqlDataAdapter.Update()</code> method. How do I solve this kind of situation where I wanted to update my data directly from a <code>DataGridView</code>?</p>
  
  <p>Here is some code (assumed connected to DB):</p>
  
  <pre><code>System.Data.SqlClient.SqlDataAdapter da;
  DataTable dt;
  SqlCommandBuilder cb;
  
  private void Form1_Load(object sender, EventArgs e)
      {
          string sql = "SELECT * FROM table1 CROSS JOIN table2 WHERE table2.Id = table1.Id";
  
          da = new System.Data.SqlClient.SqlDataAdapter(sql, db.con);
          dt = new DataTable();
  
          da.Fill(dt);
  
          dataGridView1.DataSource = dt;
      }
  
  private void updateDataGridView() 
      {
          try
          {
              cb = new SqlCommandBuilder(da);
              da.Update(dt);
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
              return;
          }
      }
  </code></pre>