Monday, June 30, 2008

DataSet.WriteXml() removes null columns

I have discovered one very annoying feature of the dataset.
When using the WriteXml() method to dump its contents to an XML file it will remove columns it doesn't think you need. I believe it removes all columns where all the values are set to null, however I haven't tested enough to know if it is simply taking a top sampling.

My work around was to check all the values for null and set them to a default value if so. It would be nice if WriteXml() gave us an option to leave the column schema alone. I didn't want the full schema written to the top of the file in this case, so I don't know if that would have made a difference.

No comments:

Post a Comment

Please leave your thoughts, I love hearing what you got out of the post. Spam comments will be removed.