DataSet.ReadXml

  • Thread starter Thread starter C Glenn
  • Start date Start date
C

C Glenn

I'm attempting to use ReadXml. It's working in that I end up with some
data in the DataSet. But I'm not able to deal with it effectively after
that. The XML file is properly formatted in that it was created with
WriteXML, so it contains the name of the table (I've inspected it to be
sure). But after calling ReadXml the DataSet does not contain a table
with the specified name. In fact, Tables does not contain a table
corresponding to the data read with ReadXml. I know that the ReadXml is
working because I can view the data in a grid.

The line of code that this thing is choking on is:

cKey[0] = Tables["Changes"].Columns["TableName"];

At this point it tells me that Tables["Changes"] doesn't exist --
returning null.

How can I control the name of the table created when ReadXml is called
or put the data from the XML file into the previously created table that
I would like it to go in?
 
Hi,

You might want to try to write out the schema as well with WriteXML, so
that ReadXML does not need to guess at the schema, but has it already
available.

-Lenard
 
How did you save the DataSet in the first place? Did you save the schema?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition
 
Back
Top