Writing XML file

K

Kelly G.

Hi all,

I have a small problem in writing XML file from VB.net. I am trying to write
the XML file using dataset.
I am able to write the XML in sequential way(one node after other). I can
write in the hierarchial(tree) structure also but only by using datagrid.
But I would like to write the XML file without using datagrid but just the
grid.

I am sending the sample. Could u please tell me how I can write
hierarchially using dataset but without using the datagrid.

Best regards,
Kelly
 
C

Cor

Hi Kelly,

A sample I made yesterday and therefore I only had to change a little bit.

I hope this helps,

Cor

\\\
'Make a datatable with 8 columns
Dim ds As New DataSet
Dim dt As New DataTable("scorpion")
For i As Integer = 0 To 7
Dim dc As New DataColumn(Chr(i + 65))
dt.Columns.Add(dc)
Next
'And 12 rows every column filled with a value
For i As Integer = 0 To 11
dt.Rows.Add(dt.NewRow)
For y As Integer = 0 To dt.Columns.Count - 1
dt.Rows(i)(y) = y.tostring
Next
Next
ds.Tables.Add(dt)
ds.WriteXml("C:\scorpion.xml")
///
 
K

Kelly G.

Thanks Cor, You've been great help!!
Cor said:
Hi Kelly,

A sample I made yesterday and therefore I only had to change a little bit.

I hope this helps,

Cor

\\\
'Make a datatable with 8 columns
Dim ds As New DataSet
Dim dt As New DataTable("scorpion")
For i As Integer = 0 To 7
Dim dc As New DataColumn(Chr(i + 65))
dt.Columns.Add(dc)
Next
'And 12 rows every column filled with a value
For i As Integer = 0 To 11
dt.Rows.Add(dt.NewRow)
For y As Integer = 0 To dt.Columns.Count - 1
dt.Rows(i)(y) = y.tostring
Next
Next
ds.Tables.Add(dt)
ds.WriteXml("C:\scorpion.xml")
///
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top