How to convert a DataTable to a string in C#?

Posted by Mark Allison on Stack Overflow See other posts from Stack Overflow or by Mark Allison
Published on 2009-07-09T14:06:11Z Indexed on 2010/05/03 19:38 UTC
Read the original article Hit count: 212

Filed under:
|
|

Hi there,

I'm using Visual Studio 2005 and have a DataTable with two columns and some rows that I want to output to the console. I hoped there would be something like:

DataTable results = MyMethod.GetResults();
Console.WriteLine (results.ToString());

What's the best way (i.e. least amount of coding from me) to convert a simple DataTable to a string?

Thanks, Mark.

© Stack Overflow or respective owner

Related posts about datatable

Related posts about conversion