Convert Dataset to xml with DBNull cells

Nrat

New Member
I need to export a DataSet to XML but all cells with the DBNull value disappear from the final XML file. DBNull values are in the middle of the table, so columns(in rows with dbnull) shift and deface the entire table. \[code\]public static string GetXmlFromDataSet(DataSet ds) { try { StringWriter sw = new StringWriter(); ds.WriteXml(sw); string outputXml = sw.ToString(); return outputXml; } catch (Exception ex) { return ex.ToString(); } }\[/code\]Then XslCompiledTransform makes the file readable for MS Excel. But without some of the cells it is unusable. I need help.
 
Back
Top