Hi,
I'm having a rather annoying problem with datasets in C# and visual studio
2008.
The scenario is that I want to get the children of a table.
The database has 2 tables, one named chapters and another one named section.
The section table has a field called chapter_id, which I use to determine the
parent of the section.
Both tables are inserted into a dataset, and I create the relationship between
chapters and section, combining chapter.id with section.chapter_id.
Seams simple enough, so when I try the following, the code never returns any
children of the chapterRow
| DiscoDBDataSetenTableAdapters.chaptersTableAdapterchap=newDisco.DiscoDBDataSetenTableAdapters.chaptersTableAdapter(); |
| DiscoDBDataSeten.chaptersDataTablechapDataTbl=chap.GetData(); |
|
| foreach(DiscoDBDataSeten.chaptersRowrowinchapDataTbl){ |
| DiscoDBDataSeten.sectionsRow[]chapter_sections=row.GetsectionsRows(); |
| //sectionRow[]isalwaysempty |
| } |
I’m grateful for any help i can get, been
stuck at this way to long now. Also I have confirmed that the data exists and
all. Another workaround I tried was to have another tableAdapter for the
section and use that one to fetch sections accordingly to their match to
chapter.id. But I'd rather not resort to that In the whole program.
I've also got the same problems in one-to-one relations.
Does not the standard generated functions from relations in the dataset work?
Best regards
// Martin