By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,566 Members | 1,783 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,566 IT Pros & Developers. It's quick & easy.

Read data from dataSet

P: n/a
Fox
I have create a dataSet and two table (father and son table) and set a
relationship between them (call father_uid (int)).

Is there any simple way, that I can get the row data include father and son
table items.
(do not use dataGuid)
eq

father_uid, father_field1,father_field2,son_field1,son_field2
1 "ABCD" 123.00 "XXXX" 456.00
1 "ABCD" 123.00 "YYYY" 567.00
2 "DEFG" 567.00 "aaaa" 456.00
2 "DEFG" 567.00 "bbbb" 567.00
2 "DEFG" 567.00 "cccc" 999.00

Thank for the help.
Nov 16 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Fox,

Normally you should be able to get it using the getchildrows
http://msdn.microsoft.com/library/de...drowstopic.asp

or/and
the getparentrow
http://msdn.microsoft.com/library/de...ntrowtopic.asp

I hope this helps

Cor
Nov 16 '05 #2

P: n/a
Fox
Thank you for your reply. It is work for normal dataSet, but don't work for
ds( read XML file). Finally thank you for you support. It is quite useful
for me.

Best Regards
Fox
"Cor Ligthert" <no************@planet.nl> 撰寫於郵件新聞:uH**************@tk2msftngp13.phx.g bl...
Fox,

Normally you should be able to get it using the getchildrows
http://msdn.microsoft.com/library/de...drowstopic.asp

or/and
the getparentrow
http://msdn.microsoft.com/library/de...ntrowtopic.asp

I hope this helps

Cor

Nov 16 '05 #3

P: n/a
Fox,

Did you write that dataset before you read it with the overloaded method to
write the schema as well?

Cor
Nov 16 '05 #4

P: n/a
Fox
No, I just load the XML to the dataSet. But I have the schema w/o use it.
Thank you very much for your help.

"Cor Ligthert" <no************@planet.nl> 撰寫於郵件新聞:ej*************@TK2MSFTNGP15.phx.gb l...
Fox,

Did you write that dataset before you read it with the overloaded method
to write the schema as well?

Cor

Nov 16 '05 #5

P: n/a
Fox
The ture question. I have a XML and its schema.
I try to load the XML file into the dataSet and display on datagrid.
I find that It show pretty good on the datagrid.
So I want to retrive the data from dataSet to SQL server.
XML file something like
<Book_Rec>
<Books>
<Book>
<Name>Book Name</Name>
<Languages>
<Language>Chinese</Language>
<Language>English</Language>
</Languages>
<Prices>
<Price><Currency>HKD</Currency><Amount>100</Amount></Price>
<Price><Currency>USD</Currency><Amount>20</Amount></Price>
</Prices>
</Book>
<Book>
<Name>Book Name2</Name>
<Languages>
<Language>English</Language>
</Languages>
<Prices>
<Price><Currency>HKD</Currency><Amount>500</Amount></Price>
<Price><Currency>USD</Currency><Amount>70</Amount></Price>
</Prices>
</Book>
</Books>
I wounder how dataSet make good Relation between Book->Language,
and Book->Price.
How the dataSet so good relationship between them?
</Book_Rec>
"Cor Ligthert" <no************@planet.nl> 撰寫於郵件新聞:ej*************@TK2MSFTNGP15.phx.gb l...
Fox,

Did you write that dataset before you read it with the overloaded method
to write the schema as well?

Cor

Nov 16 '05 #6

P: n/a
Fox,

I dont know how you are making this dataset.

Some links
http://msdn.microsoft.com/library/de...ationships.asp

For the way you want it is the "Nested" property important "IsNested" has to
be true

http://msdn.microsoft.com/library/de...d_elements.asp

I hope this helps,

Cor
Nov 16 '05 #7

P: n/a
Fox
I just direct load the XML data file to the dataSet
System.Data.DataSet ds = new System.Data.DataSet();
ds.ReadXml("c:\\test.xml");
"Cor Ligthert" <no************@planet.nl> 撰寫於郵件新聞:eo**************@TK2MSFTNGP14.phx.g bl...
Fox,

I dont know how you are making this dataset.

Some links
http://msdn.microsoft.com/library/de...ationships.asp

For the way you want it is the "Nested" property important "IsNested" has
to be true

http://msdn.microsoft.com/library/de...d_elements.asp

I hope this helps,

Cor

Nov 16 '05 #8

P: n/a
Fox,

As far as I can see do you have in this dataset two tables, Books and
Languages which are saved nested

When you want to save them to SQL server you will have to have those tables
as well in that and update (in fact insert) them seperatly.

Normally first the books and than the languages.

I hope this helps?

Cor
Nov 16 '05 #9

P: n/a
Fox
Thank, I find the answer
"Cor Ligthert" <no************@planet.nl> wrote in message
news:O$**************@tk2msftngp13.phx.gbl...
Fox,

As far as I can see do you have in this dataset two tables, Books and
Languages which are saved nested

When you want to save them to SQL server you will have to have those tables as well in that and update (in fact insert) them seperatly.

Normally first the books and than the languages.

I hope this helps?

Cor

Nov 16 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.