Problem with Dataset.WriteXML

M

Morten Snedker

This is the code:

Try
Dim con As New
SqlConnection("server=comwirsql;database=comwirdirect;Trusted_Connection=yes")
Dim dGetData As SqlDataAdapter = New
SqlDataAdapter("sp_AccessUser2FTP", con)
dGetData.SelectCommand.CommandType =
Data.CommandType.StoredProcedure

Dim dDataset As New Data.DataSet
dGetData.Fill(dDataset)

With dDataset
.DataSetName = "AccessUser"
.WriteXml("E:\output.xml")
'.WriteXmlSchema("e:\output.xsd")
End With

dDataset.Dispose()
dGetData.Dispose()
Catch ex As Exception
Response.Write(ex.Message)
End Try

This creates:

<AccessUser>
<Table>
<Lastname>hans</Lastname>
<Emailaddress1 />
</Table>
....

How do I avoid the creation of the Table tag?

Regards /Snedker
 
G

Guest

Hi,

DataSet is memory representation of collection of tables. Thus you will
always have some tag representing table in dataset. You can use DataTable
instead of DataSet to reduce number of tags in resulting xml.

Regards,
Ladislav
 
M

Morten Snedker

Thanks for input. Changed to datatable and all's well!

Regards /Snedker

Ladislav Mrnka skrev:
 

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top