Additional column with "0" in each datatable of a DataSet


#1

Attached is a sample xml file. When I read the Xml file into the dataset using ds.ReadXml, it seems to populate every datatable with an additional column, which is not in the schema or the data layout, with “0” as the value. How can I eliminate this extra column, and why does it appear?


#2

In your file:


2603
Caduet
Pfizer

2005-02-04
0.5776000000000000023092638912203256040812

Please try to remove :


2603
Caduet
Pfizer
2005-02-04
0.5776000000000000023092638912203256040812


#3

Thank you, Laurence. I will try and see if it works.


#4

I do not think that is the problem. In the Data sheet, the DataType column is displayed in the correct sequence, with a blank value in each row. The extra column is titled “graph_Id”, which appears nowhere in the XML file. It is the seventh column, whereas there are only 6 elements (columns) in the GraphDataPoint table. This is also happening for all other tables populated into the dataset from the XML.


#5

Using the dataset created from the same XML file attached to this issue earlier, I wrote some code to get the "series" table into a DataView and set the Sort property to "seqNo ASC". It does not sort on seqNo. I moved the "series" elements around to make sure they are not in order of seqNo. I know that this is not a question directly related to the Aspose.Cells component, but would you have any idea as to why the DataView will not sort?

The sort function seems to work fine in other parts of my application for some other tables from the dataset.

Here is the problematic code:

DataView dv = ds.Tables["series"].DefaultView;

if (ds.Tables["series"].Rows[0]["seqNo"].ToString() != "")

{

dv.Sort = "seqNo ASC";

}

And then I use dv.Table to retrieve the data, but it is not sorted.


#6

Please use dv to retrieve data instead of using dv.Table to retrieve data. The dataview is sorted but the datatable is not.


#7

Thanks a lot, Laurence. That worked. I appreciate your assistance in this though this was not a question directly related to your product.