Datatable lot of Columns

  • Thread starter Paperback Writer
  • Start date
P

Paperback Writer

Hi I have around 40 columns from my PROC and i need to return as a DataTable
but if very difficulty to me add the columns in DataTable manually...Is
there a way to accomplish that dinamically ?

Manually:
dt.Columns.Add(new DataColumn("col_1"));
dt.Columns.Add(new DataColumn("col_2")); AND SO ON...

How do i do dinamically without be one by one ?
 
K

Ken Cox [Microsoft MVP]

Is there a reason why you need to create this yourself? If you get a
dataset, it will create those columns for you. The datagrid will also
display the columns automatically.
 

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

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top