Let’s say we have a product table where each row represents product details like product Id, Name, Description , Price etc. Now customer might be interested to view products across (i.e. columns) and features down (row wise). This basically requires transposing product table’s rows and columns as illustrated below. The first step is to create the new Data Table and its schema from the rows of the input table. In the following code snippet, source refers to the input table and dest is the new pivoted table. //Create Destination Table DataTable dest = new DataTable("Pivot" ); // from each source table row (1st column) // create a destination column foreach( DataRow r in source.Rows ) dest.Columns.Add( r[0].ToString() ); // assign each row the Product name Now that we have the appropriate columns defined in the schema of the destination table, the next step is to create a DataRow for each feature defined in the columns of the source table, excluding the first column representing the Product name. //Create columns in destination table for each row in source table. for( int i = 0; i < source.Columns.Count - 1; i++ ) dest.Rows.Add( dest.NewRow() ); The final step is the actual transform of the columns from the source rows into the destination table. Since each table now represents a two dimensional array of its rows and columns, a very simple transform of all columns and rows could be performed by the following nested for loop. //Transpose rows and columns for( int r = 0; r < dest.Rows.Count; r++ ) for( int c = 0; c < source.Columns.Count; c++ ) dest.Rows[r][c] = source.Rows[c][r]; Ravindra Sadaphule MCSD.NET