Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting dataset to xml
Message
From
27/10/2005 12:34:16
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
27/10/2005 12:27:05
General information
Forum:
ASP.NET
Category:
XML
Miscellaneous
Thread ID:
01062521
Message ID:
01062681
Views:
21
>Hi Cetin,
>
>thanks for your answer.
>
>
>>   private void WriteDataSetToXMLFile(DataSet ds, string filename)
>>   {
>>	if (ds == null) { return; }
>>	XmlTextWriter xmlWr = new XmlTextWriter(filename, Encoding.UTF8);
>>	xmlWr.Formatting = Formatting.Indented;
>>	XmlSerializer xs = new XmlSerializer(typeof(DataSet));
>>	xs.Serialize(xmlWr, ds);
>>	xmlWr.Close();
>>   }
>
>
>This method writes to a file.
>How can I change it to return the XML string as a return value of the method?

You could use a memorystream:

MemoryStream ms = new MemoryStream();
XmlTextWriter xmlWr = new XmlTextWriter(ms, Encoding.UTF8);

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform