S
suzy
hello,
i have a problem, i wonder if anyone can help...
i am retrieving records from an access table using a dataset and want the
data to be returned in xml, so i am using the dataset.GetXml() method.
lets say, for example, that the xml is in the following format:
<Users>
<User>
<UserId>1</UserId>
<Username>robert</Username>
<Password>friend</Password>
</User>
<User>
<UserId>2</UserId>
<Username>natasha</Username>
<Password>sunny</Password>
</User>
</Users>
with this xml, i can easily read values from the xml by selecting the node i
want.
however, my problem occurs if i do an inner join in my user table (lets say
from the users table, to the address table). the xml then gets returned
something like this:
<Users>
<User>
<User.UserId>1</User.Id>
<Username>robert</Username>
<Password>friend</Password>
<AddressId>11</AddressId>
<Address.UserId>1</Address.UserId>
<AddressLine1>11 main road</AddressLine1>
<AddressLine2>london</AddressLine2>
</User>
<User>
<User.UserId>2</User.UserId>
<Username>natasha</Username>
<Password>sunny</Password>
<AddressId>12</AddressId>
<Address.UserId>2</Address.UserId>
<AddressLine1>12 main road</AddressLine1>
<AddressLine2>london</AddressLine2>
</User>
</Users>
as you can see, when there are fields with the same name across the tables
in the inner join, the node gets prefixed with the table name. this causes
a problem when it comes to reading values out of the xml because:
sometimes i might be doing an inner join, sometimes i might not be doing an
inner join.
the node names change depending on whether i join or not, so how does my
code that reads the values from the xml know what to look for?
i dont want to write separate code for each join scenario... is there a way
around this? maybe there is a way to force the .getxml method to ALWAYS
prefix fields with the table name?
many thanks.
i have a problem, i wonder if anyone can help...
i am retrieving records from an access table using a dataset and want the
data to be returned in xml, so i am using the dataset.GetXml() method.
lets say, for example, that the xml is in the following format:
<Users>
<User>
<UserId>1</UserId>
<Username>robert</Username>
<Password>friend</Password>
</User>
<User>
<UserId>2</UserId>
<Username>natasha</Username>
<Password>sunny</Password>
</User>
</Users>
with this xml, i can easily read values from the xml by selecting the node i
want.
however, my problem occurs if i do an inner join in my user table (lets say
from the users table, to the address table). the xml then gets returned
something like this:
<Users>
<User>
<User.UserId>1</User.Id>
<Username>robert</Username>
<Password>friend</Password>
<AddressId>11</AddressId>
<Address.UserId>1</Address.UserId>
<AddressLine1>11 main road</AddressLine1>
<AddressLine2>london</AddressLine2>
</User>
<User>
<User.UserId>2</User.UserId>
<Username>natasha</Username>
<Password>sunny</Password>
<AddressId>12</AddressId>
<Address.UserId>2</Address.UserId>
<AddressLine1>12 main road</AddressLine1>
<AddressLine2>london</AddressLine2>
</User>
</Users>
as you can see, when there are fields with the same name across the tables
in the inner join, the node gets prefixed with the table name. this causes
a problem when it comes to reading values out of the xml because:
sometimes i might be doing an inner join, sometimes i might not be doing an
inner join.
the node names change depending on whether i join or not, so how does my
code that reads the values from the xml know what to look for?
i dont want to write separate code for each join scenario... is there a way
around this? maybe there is a way to force the .getxml method to ALWAYS
prefix fields with the table name?
many thanks.