PC Review


Reply
Thread Tools Rate Thread

How to convert a Dataset into a xml strin

 
 
Michael Kugler
Guest
Posts: n/a
 
      27th Jun 2006
Hi NG

How is it possible to convert a dataset into a XML string without saving it
to a file?
ds.writetoxml() only allows a filename.


---
Mit freundlichen Grüßen / Yours sincerely ,

Michael Kugler


Compunited
Inh.: Michael Kugler
Hasellohweg 19
90766 Fürth
Germany

Tel +49(911)1327142
Fax +49(911)1327143

Cell Phone +49(162)2656942


 
Reply With Quote
 
 
 
 
Peter Foot [MVP]
Guest
Posts: n/a
 
      27th Jun 2006
In .NETCF v1.0 you'll need to write to a file, read the file contents and
then delete it. In .NETCF v2.0 you can use the WriteXml overload which takes
a stream and write to a memory stream or whatever you require.

Peter

--
Peter Foot
Windows Embedded MVP
www.peterfoot.net | www.inthehand.com

"Michael Kugler" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi NG
>
> How is it possible to convert a dataset into a XML string without saving
> it to a file?
> ds.writetoxml() only allows a filename.
>
>
> ---
> Mit freundlichen Grüßen / Yours sincerely ,
>
> Michael Kugler
>
>
> Compunited
> Inh.: Michael Kugler
> Hasellohweg 19
> 90766 Fürth
> Germany
>
> Tel +49(911)1327142
> Fax +49(911)1327143
>
> Cell Phone +49(162)2656942
>



 
Reply With Quote
 
Ilya Tumanov [MS]
Guest
Posts: n/a
 
      27th Jun 2006
DataSet.GetXml() should work.

--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/...ramework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

"Michael Kugler" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi NG
>
> How is it possible to convert a dataset into a XML string without saving
> it to a file?
> ds.writetoxml() only allows a filename.
>
>
> ---
> Mit freundlichen Grüßen / Yours sincerely ,
>
> Michael Kugler
>
>
> Compunited
> Inh.: Michael Kugler
> Hasellohweg 19
> 90766 Fürth
> Germany
>
> Tel +49(911)1327142
> Fax +49(911)1327143
>
> Cell Phone +49(162)2656942
>



 
Reply With Quote
 
Michael Kugler
Guest
Posts: n/a
 
      28th Jun 2006
Hi Ilya

This works excelent. Is there also a new way for getting XML to dataset in
2.0
Right now i'm doing it like that:

Me.StatusBar1.Text = "fetch Artikel"
Me.StatusBar1.Refresh()

lcxml = ws.GetArtikelTable(1)

buffer = System.Text.Encoding.ASCII.GetBytes(lcxml)

ms = New System.IO.MemoryStream(buffer)

xtr = New System.Xml.XmlTextReader(ms)

ds = New Data.DataSet

ds.ReadXml(xtr, Data.XmlReadMode.InferSchema)

xtr.Close()

ms.Close()


 
Reply With Quote
 
Ilya Tumanov [MS]
Guest
Posts: n/a
 
      28th Jun 2006
That's pretty much as good as it gets with strings - very slow and nasty
with several copies of the same thing in memory.



The right way to do it is to change WS (I'm assuming you're using Web
Services) to return/take dataset instead of string.



Also, using inference is asking for troubles as it could produce results you
do not expect or fail. It also very slow and takes tons of memory.

DataSet with schema in any form (Typed DS with embedded schema, schema
loaded separately, schema in XML file with data or schema created
programmatically) is the way to go.



If XML string you sending was not produced by DataSet, it might fail as
well.


--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/...ramework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

"Michael Kugler" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Ilya
>
> This works excelent. Is there also a new way for getting XML to dataset in
> 2.0
> Right now i'm doing it like that:
>
> Me.StatusBar1.Text = "fetch Artikel"
> Me.StatusBar1.Refresh()
>
> lcxml = ws.GetArtikelTable(1)
>
> buffer = System.Text.Encoding.ASCII.GetBytes(lcxml)
>
> ms = New System.IO.MemoryStream(buffer)
>
> xtr = New System.Xml.XmlTextReader(ms)
>
> ds = New Data.DataSet
>
> ds.ReadXml(xtr, Data.XmlReadMode.InferSchema)
>
> xtr.Close()
>
> ms.Close()
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert typed DataSet to untyped DataSet zlf Microsoft C# .NET 1 26th Oct 2007 04:40 PM
Counting SubStrings and thier starting positions within Main Strin =?Utf-8?B?RXhjZWxNb25rZXk=?= Microsoft Excel Programming 2 7th Feb 2006 07:27 PM
Strin in Quotation marks David Microsoft C# .NET 3 3rd Aug 2004 05:18 PM
Convert regular DataSet to strongly typed DataSet moondaddy Microsoft ADO .NET 3 20th Apr 2004 09:37 AM
trying to us RELATIVE PATH ON MY CONNECTION STRIN RAW Microsoft ASP .NET 2 16th Nov 2003 11:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:47 PM.