DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 14 Aug 2007 10:58:32 +0200,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Morten Snedker
          2    Ladislav Mrnka
          3    Morten Snedker


Problem with Dataset.WriteXML   
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
Date:Tue, 14 Aug 2007 10:58:32 +0200   Author:  

RE: Problem with Dataset.WriteXML   
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

"Morten Snedker" wrote:


> 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
> 
Date:Tue, 14 Aug 2007 02:06:03 -0700   Author:  

Re: Problem with Dataset.WriteXML   
Thanks for input. Changed to datatable and all's well!

Regards /Snedker

Ladislav Mrnka skrev:

> 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
> 
> "Morten Snedker" wrote:
> 
>> 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
>>
Date:Tue, 14 Aug 2007 11:40:23 +0200   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us