title: Inserting Dataset into DataTable
body: <p>I'm stuck at the moment with the problem below. I'll try and explain it as best as I can but let me know if you need more clarification. I've put some things in a google spreadsheet to help with the explanation, link below.</p>
  
  <p><a href="https://spreadsheets.google.com/ccc?key=0An70K3Q_IiWAdGpfV2YzNFQ4aTYxTWIxSUd5azVMWEE&amp;hl=en&amp;authkey=CMO898QP" rel="nofollow">https://spreadsheets.google.com/ccc?key=0An70K3Q_IiWAdGpfV2YzNFQ4aTYxTWIxSUd5azVMWEE&amp;hl=en&amp;authkey=CMO898QP</a></p>
  
  <p>Spreadsheet:<br>
  MainTable = C# Application DataTable<br>
  Data = SQL Results from an SQL Query (Dataset)</p>
  
  <p>The data spreadsheet needs to be translated/converted into the format specified in the MainTable spreadsheet.</p>
  
  <p>Each rowid is there because they relate to something unique. So for example. If we assume rowid 1 is for "Total sales for this month", you can see in the Data spreadsheet that cell C2 needs to go to cell E2 on the MainTable spreadsheet.</p>
  
  <p>If we assume rowid 2 is for "stock on the shelf", you can see in the Data spreadsheet that cell D3 needs to go to cell F3 on the MainTable spreadsheet.</p>
  
  <p>... and so on. I first approached it with the code below but that's not going to work because the prodcode is not unique in my dataset. I'd create another dataset or list but then I'm unsure of where to go from there. Am I looking at it wrong?</p>
  
  <pre><code>foreach (DataRow dsrow in dsproduct.Tables["loadUniqueProducts"].Rows)
          {
              string prodcode = Convert.ToString(dsrow["prodcode"]);
  
              for (int i = 1; i &lt;= 14; i++)
              {
                  row = table.NewRow();
                  row["rowid"] = i;
                  row["prodcode"] = prodcode;
                  table.Rows.Add(row);
              }
          }
  </code></pre>
  
  <p>Thanks for the help.</p>