col4 col3 col2 col1 8 5 1 1 9 2 7 4
col4 col3 col2 col1 8 5 1 1 8 2 1 1 8 4 1 1 9 5 1 1 9 2 1 1 9 4 1 1 7 5 1 1 7 2 1 1 7 4 1 1
for (var v = 0; v < dt.Rows.Count; v++) { int s = 0; for (var k = dt.Columns.Count; k > 0; k--) { DataRow d = dtRecord.NewRow(); if (dtRecord.Columns.Contains(dt.Columns[k - 1].ToString())) { d[dt.Columns[k - 1].ToString()] = dt.Rows[v][dt.Columns[k - 1].ToString()].ToString(); if (s == 0) dtRecord.Rows.Add(d); else dtRecord.Rows[v][dt.Columns[k - 1].ToString()] = dt.Rows[v][dt.Columns[k - 1].ToString()].ToString(); s++; } } }<pre>
DataTable ExpandDataTable(DataTable dt) { var dt = new DataTable(); // configure columns // iterate and build new DataTable return dt; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)