title: How to use SQL Command Builder and SQL Data Apdater
body: <p>I read SQL Command Builder class from
  <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommandbuilder.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommandbuilder.aspx</a> and I found that I can show update done on dataset/database using select and update command. </p>
  
  <p>SQL Command Builder concept is clear if I am using single dataset but what if I want to use two different dataset?</p>
  
  <p>Scenario: I am reading values from database into one dataset ds1; which is assign to sql adapter and sql command builder. Now, I am reading only selected values from ds1 and storing into second dataset ds2; which is not assign to sql data adapter and sql command builder. </p>
  
  <p>I am concern if I am updating any data on ds2 whether it will update database or not. Also, how should I do it using SQL Command builder and SQL Adapter. </p>
  
  <p>//primary dataset </p>
  
  <pre><code>ds = new ProductDataSet();
          command = new SqlCommand(
              "SELECT no, name, price, cost, dept FROM PRODUCTS", connection);
          adapter = new SqlDataAdapter();
          adapter.SelectCommand = command;            
          adapter.Fill(ds, "table");
  </code></pre>
  
  <p>Primary dataset is fill on form load event. User will enter item no of his choice which will be search from primary ds and saved/display onto 2nd ds (2nd ds is not connected with with any adapter or command builder right now). For eg; 2nd ds have 3 items. </p>
  
  <p>Now say user update any information on 2nd ds it should automatically update database and display on grid. </p>
  
  <p>//2nd ds2 update code </p>
  
  <pre><code>for (int i = 0; i &lt; ds2.Tables[0].Rows.Count; i++)
                              {
   string item = ds2.Tables[0].Rows[i][0].ToString();                   
  
  command = new SqlCommand("UPDATE PRODUCTS SET " + _colName + " = '" + _newValue + "'" + "WHERE ITEM_NO = '" + item + "'", Class1.conn);                                    
  datagrid.DataSource = ds2.Tables[0];
  </code></pre>
  
  <p>}</p>
  
  <p>According to your suggestion if I am adding/declaring adapter/builder in above code it doesn't work. I am getting Table Mapping error.</p>