Adding Columns to DataSet-DataTable out of Position

G

Guest

Is it possible to add a column to an existing DataTable (in a DataSet) with
the new column being some place other than the end of the column collection?

I looked at Columns.Add and there is no position parameter and there is no
InsertAt method like some other collections.

Is this possible through some other means? Maybe create a new Table and
copy data???

Thanks,

Ashton
 
G

Guest

Not sure what the purpose would be.

If you are worried about display, you can simply turn off the automatic
column generation and control the DataGrid output (etc.) with either tags
(best case - always the same columns added) or code (worst case, but still
rather simple).

If you are stuck on this idea, you will have to rebuild the DataSet. There
are two options I can think of:

1. Loop through the old and create the new on the fly, including the new
columns
2. Work with the DataSet as XML, which still requires looping to absolutely
position the items


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
G

Guest

Gregory,

That's what I figured. I am calling the fn_trace_gettable SQL function to
get tracing results and wanted to add a field for the EventClass Description
at the beginning of the results so I could just pass it to the grid I'm using
directly.

I guess I'll just manually set the columns in the display order I need.

Thanks,

Ashton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top