Create DataSet from ArrayList

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

How can I create a dataset from an arraylist? I thought I could fill a
dataset using an arraylist as the datasource but I can't find the way to do
this?

Wayne
 
Hi Wayne,

You cannot, you can maybe make a datatable from an arraylist however than
the simple one will be very simple something as this typed here without any
check so watch typos
\\\
dim dt as new datatable("wayne")
dt.columns.add("w1")
for i as integer = 0 to arraylist.count - 1
dim dr as new datarow = dt.newrow
dr(0) = arraylist(i).tostring
dt.rows.add(dr)
next
'and when it has to be on a dataset
dim ds as new datataset
ds.tables.add(dt)
///

However this is a one dimensional arraylist.

I hope this helps?
Cor
 
Thanks Cor;

I guess I'll loop through the arraylist and write it out to a table and then
read it in to get the dataset.

Wayne
 
Back
Top