Is there a way to create n columns?
Is there a way to create n columns?

What I would want is to create as many columns as records I have in a table. The idea would be to make some kind of "foreach" inside the declaration. Is there any way?
Thank you
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Sure - create your array of columns using whatever loop you need (a foreach for example).
Columns cannot be dynamically added to a DataTable after initialisation, but you can certainly add as many columns as you want when you initialise it.
Allan