I have the data table below. I would like to change the data table to transform the data table into the one next to it. How can I do this?
The reason why i would lik
.NET does not include a method to transpose data tables. You have to make your own. This website has a tutorial on an example transpose method. I will copy and paste the code snippet below:
private DataTable Transpose(DataTable dt)
{
DataTable dtNew = new DataTable();
//adding columns
for(int i=0; i<=dt.Rows.Count; i++)
{
dtNew.Columns.Add(i.ToString());
}
//Changing Column Captions:
dtNew.Columns[0].ColumnName = " ";
for(int i=0; i