title: Asp.net + C#: Copy DataColumn from tableA to table B
body: <p>I would like to copy DataColumn from tableA to table B:</p>
  
  <p>As I think it should be like this:</p>
  
  <blockquote>
    <p>TableA in perdefined.</p>
    
    <p>DataColumn[] dataColum = new
    DataColumn[TableA .Columns.Count];</p>
    
    <p>TableA .Columns.CopyTo(dataColum, 0);</p>
    
    <p>DataTable TableB = new DataTable();</p>
    
    <p>TableB .Columns.AddRange(dataColum);
    //
  </blockquote>
  
  <p>=> but it raised an error at the line error, ID is belong to another table (in tableB)...</p>
  
  <p>As I dont like another way:</p>
  
  <blockquote>
    <p>DataTable TableB = TableA.Copy();
    TableB.Clear(); // => getting
    structure of table A, not nice this
    way</p>
  </blockquote>
  
  <p>Any ideas? Thanks in advance!</p>