dataset & xml...

alanchinese

Regular
Joined
Jan 12, 2005
Messages
62
i have the following file called alan.xml

<alan>
<one>
<jump>1</jump>
<sit>2</sit>
</one>
<one>
<jump>9</jump>
<sit>2</sit>
</one>
</alan>

alan is the root, one is the table name, jump & sit is the column names. if i do MyDataSet.ReadXml("alan.xml"), it will have two tables, but i want to only consider table "one".

ok, i put a datagrid in the form, assign MyDataSet.Tables("one") to the datasource. it shows two columns in the datagrid: jump & sit. that's normal.

however, when i tried to do MyDataSet.WriteXml("alan.xml") after i added a new row inside the datagrid, it gives me an error which i found out it's because the column numbers of the added new row are not maching the dataset.

i tried to display the structure of the datatable, it has one extra column call "alan_id".

my question is, why didn't the datagrid show the "alan_id" column? how can i use the datagrid to change the datatable and reflect the changes in the xml file by using WriteXml?
 
i noticed that there is an auto-incremental column name "alan_Id", that when you try to add a new role in the datagrid, that column is not updating....
 
finally... i did me.datagrid1.datasource = me.dataset1.tables("alan").defaultview.table

it works!

why is it like that?
 
Back
Top