Is there a way to create n columns?

Is there a way to create n columns?

si08789si08789 Posts: 15Questions: 6Answers: 0

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

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    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

This discussion has been closed.