Recently I was in the need to serialize a DataTable
as a string for further processing (storing in a file).
So I asked myself: How to serialize a DataTa
You can also do this.
DataTable dt = new DataTable()
//... Fill Datatable from SQL or a thousand other places you have seen on the net.
Response.ContentType = "text/xml";
dt.WriteXml(Response.OutputStream);
Response.Flush();
Response.End();
Documentation found at
http://msdn.microsoft.com/en-us/library/system.data.datatable.writexml(v=VS.100).aspx