Debugging DataSets
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.
Comments
- Anonymous
September 10, 2003
The comment has been removed - Anonymous
September 10, 2003
Wow...that's awesome. Being a C++ programmer, I've never had the benefit of an immediate window while debugging like VB6 developers have, so this is definitely something that I'll have to get used to. It looks like a great time saver, though, so I'll have to remind myself to use it from time to time.