This post originated from an RSS feed registered with .NET Buzz
by Tim Sneath.
Original Post: Debugging DataSets
Feed Title: Tim Sneath's Blog
Feed URL: /msdnerror.htm?aspxerrorpath=/tims/Rss.aspx
Feed Description: Random mumblings on Microsoft, .NET, and other topics.
When you're debugging code with Visual Studio .NET, it's really hard to see what data
is currently contained within a DataSet. Sure, the Locals window will show any DataSet
objects currently in scope, but finding out what data is contained within them is
not easy.
Two good ways of accessing this information both revolve around the XML methods available
on the object. Firstly, if you've got a console window associated with your application,
you can do:
ds.WriteXml(Console.Out);
which uses the stream-based overload of the WriteXml method to dump the DataSet to
the console.
It's even easier if you've got a VS.NET Command window open (hit Ctrl+Alt+A). Make
sure you're in immediate mode by entering immed, and then simply run:
? ds.GetXml()
This dumps the contents of the DataSet to the Command window.