Additional column "Subject_Id" appeared !

tayhk

Member
Joined
Nov 18, 2002
Messages
7
When I tried to read XML file by using XMLReader :

ToRecDBDataset.ReadXml(xmlfilepath)

An additional column called "Subject_Id" appeared in my dataset "Course" table. Because there is another table called "Subject_Id" in the same XML file !

How to eliminate this column in my Course table !
(I didnt use schema to bind my data)

Any suggestions are appreciated ! Thanks a lot !!!
 
Im a bit confused - I dont see a Subject_ID anywhere in your picture, as a column or as a Table. Each node off the root node (NewDataSet being the root node in your case) should be a table name. From your picture, Course, Exam, Staff, and Subject are tables. Each element under those are columns.

Did you mean to say that Course is showing up as a column in your Subject table and it shouldnt? I cant guess why without seeing your code but I bet its in there somewhere :)

By the way, a DataSet has a property called nested (I forget exactly where at the moment - it might be at the table level or some place else). If you set Nested to true, the XML that comes out will be nested, which may or may not be something you could use in the future.

As another note, if you use the DataSets WriteXml method in code, you can specify WriteSchema to include the table/column definitions in the XML. This would be useful to see as well, to see what the DataSet thinks the tables/columns are.

If your DataSet is based off of raw XML (no table/column definitions) then the above may not work. I cant remember if the DataSet generates an inferred schema or not (assumes a schema based on the data it sees).

Regardless, it would be nice to see the original XML file as well as any relevant code that creates it and/or what youre doing once youve read it in. Its also nice to know what it should be doing, as well as whats not right.

-nerseus
 
Back
Top