DataReader Output as XML

  • Thread starter Thread starter binder
  • Start date Start date
B

binder

Can a DataReader output XML directly similar to the functionality
offered by a DataSet?
I have a C# Web Service that returns read-only data and I would like to
output it as an XML string without using the overhead of a DataSet.
 
I think you'd have to do roll your own XmlWriter to accomplish this.
I'd say that for 1.1.

For 2.0, I ~think there is a "Create a DataSet from a IDataReader", which
might be fast enough.

I don't think Microsoft is doing any fairy magic behind the scenes.
Somewhere, there is a loop over an IDataReader, populating xml.
If you want speed, then an IDataReader coupled with an XmlWriter would be
where I first went.

...

This might get you started:
http://www.codeproject.com/aspnet/SquaredRomiss.asp
 
Back
Top