dataset tablemapping notmapping properly after read XML

  • Thread starter Thread starter Marco Martin
  • Start date Start date
M

Marco Martin

Hi everyone,

I've got a dataset with a records table that is built up from scratch
according to user input. I'm saving this dataset as xml by using
dsRecords.WriteXml(dlgSave.FileName,XmlWriteMode.WriteSchema);

The first problem I had was that all hidden columns (ie: recordID) values
were not written to file. So I set the mapping types of the hidden columns
back to "Element" just before saving.

Now, I read the file back using

dsRecords.ReadXml(dlgOpen.FileName, XmlReadMode.ReadSchema);

All is well, I can see all the data that was written to file...Except that,
When I set the column mappings back to hidden ,tell the dataset to
..acceptchanges() and set the .datasource of my datagrid to the Records table
I still see all of the hidden columns. I even tried to set the table
mappings everytime I set the datasource to the datagrid but to no avail.

Any ideas would be appreciated.

Thanks and best regards,

Marco
 
figured it out;
I actualy had to hide the columns inside the datagrid instead of using
datatable.tablemappings.

I can really understand why though. I was reading the xmlschema first, then
applying tablestyles to the datatable, then loading the actual data. But
once loaded, the dataset completely ignored the hidden columns. It would be
a nice touch for M$ to add as functionality to the datasets XMLReader
 
Back
Top