?
Solved

How do I convert an ArrayList to a dataset?

Posted on 2006-06-08
5
Medium Priority
?
1,339 Views
Last Modified: 2012-08-13
Hello,

I have an ArrayList holding a specific object type. I need to convert into a dataset so I can write it to an .xml file format and then export it to a report. Anyone know how to do this?

Thank you,

Zac
0
Comment
Question by:sacul
2 Comments
 
LVL 7

Accepted Solution

by:
prosh0t earned 1600 total points
ID: 16861982
Hello Zac,
I think this is your solution:

Dim dsTemp As DataSet = New DataSet
Dim dTbl As New DataTable

dTbl.Columns.Add("myColumn")
dsTemp.Tables.Add(dTbl)
Dim arr As New ArrayList
arr.Add("1")
arr.Add("2")
arr.Add("3")
arr.Add("4")
Dim str As String

For Each str In arr
    Dim dRow As DataRow
    dRow = dTbl.NewRow()
    dRow("myColumn") = str
    dTbl.Rows.Add(dRow)
Next

dsTemp.WriteXml("c:\test.xml")


hope this helps.  Good luck.

0
 
LVL 6

Expert Comment

by:cubixSoftware
ID: 16861991
Couple of questions

1. What object type is held
2. Why don't you simply loop thru your arraylist and build the XML format

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question