When adding a row to an existing table it creates a new table... How come??
I've got an xml file that looks like the following:
<General>
<Date />
<Title>Title goes here</Title>
<Category id="5">My Category</Category>
<Users>
<User position="1">
<Email>test@test.com</Email>
<Phone>555.555.5555</Phone>
<Name>John Doe</Name>
<UserID>1</UserID>
</User>
</Users>
<Area id="12">United States</Area>
</General>
It's important to view the tags in the xml file. Please use the attached text file.
I read this file into a dataset named DS and then I would
like to add a new User to it. At the end I set a
datagrid's source to my dataset so I can examine the
results
If I do:
Dim row as datarow
row = DS.Tables("User").NewRow
row.Item("Name") = "New Guy"
DS.Tables("User").Rows.Add(row)
DataGrid1.DataSource = DS
Then when I examine my datagrid, I see both a "Users" and
a "User" table.
If I click on the "Users" table, I then have to expand a
little plus sign (like I'm accessing the top level of a
dataset in a datagrid), and in there I see "Users_User",
which if I click on it displays my original data (before
I added the new row).
I believe the "Users_User" defines a relationship saying
the "User" table belongs in the "Users" table, however, I
don't understand why I don't see the new row I added in
it.
If in the datagrid I go back to the main node level, and
click on the "User" table, I see both my rows.
Why is it that when I add a new row it isn't added to
my "Users_User" table? I'm guessing it has something
to do with a parent/child relationship between the
original row in my "User" table with the "Users" table,
but if I created my new row based off of a new row of
the "User" table, shouldn't it also contain the
relationship? Or do I need to define a relationship for
this row I'm adding? Or do I just not understand what is
going on here??
Thanks.

