Dataset Column Not Saving

Hello, I am adding a new column to a dataset. If I don't add any values to this column, and write the dataset to xml, it skips this column. Does anyone know why
Thanks


Answer this question

Dataset Column Not Saving

  • Sean Sandys - MS

    That behavior is by design - it is exactly the way an XML writer should act. If there's no data, don't write anything.

    Keeping track of what fields go where isn't the data file's business, but that of the schema definition file.


  • fp101

    I have case where there appears to be no data in a column and yet I get a node in the XML file that looks like this:

    <data />

    In other cases I get nothing. Why would there be nothing in some cases, and in others there is a node like the one above


  • Burbank Steve

    You can control that behavior with the second parameter to WriteXml (XmlWriteMode). It allows you to also persist the schema, so that when you read it, you will have all table/columns definitions.

    --VV

  • Dataset Column Not Saving