Inserting a column in DataTable at a specified ordinal position

Aarvee

Well-known member
Joined
Sep 21, 2005
Messages
50
Location
Bangalore, India
Programming Experience
Beginner
Hi !

I have put this query in WinForm Grids since the data table is being bound to the DataGrid.

Generally when I design the databases, the calculated columns are omitted since they can be computed at run time instead of being stored. Hence when we retrieve the data from the database table into a datatable, these columns are not present.

We can add a column to the datatable and then place the computed values into that column. However such an inserted column comes at the end of the table rather than at a position which is more user friendly.

One alternative is to first create a datatable with the specified columns and the order in which they should appear and then port the data from the database into such table through a loop. Instead I would like to know whether it is possible to insert a column at a specified position in the datatable.

Thanks

Varadarajan R
 
Back
Top