| A | B | C | E |
supposed that, I have DataTabe and column is given above format now I want to add new column "D" in between C and E
How it possible. If it is possible then how plz Explain.
| A | B | C | E |
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dipankar BiswasPosted Sep 18, 2014, 5:01 AM
ds.Tables.Add(new DataTable());
ds.Tables[0].Columns.Add("column_1", typeof(string));
ds.Tables[0].Columns.Add("column_2", typeof(int));
ds.Tables[0].Columns.Add("column_4", typeof(string));
ds.Tables[0].Columns.Add("column_3", typeof(string));
//set column 3 to be before column 4
ds.Tables[0].Columns[3].SetOrdinal(2);
see more...
http://stackoverflow.com/questions/351557/how-does-one-insert-a-column-into-a-dataset-between-two-existing-columns