Multiple data-table display in data control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an application with a list of questions, which are associated with
answers by a questId in a one-to-one relationship. The questions may come
from an XML file or a SQL Server database. The answers data will always come
from a SQL Server database. I am trying to use a DataList (preferably) or
Repeater to display the questions and update the answers.

I am using .Net 1.1. I have created a DataSet with separate tables for
questions and answers, and explicitly created the QuestAnswer relationship.
I have data-bound the DataList to the DataSet (not the individual tables).
The question detail displays, but the answers error out with no-such-column.

I have found the hierarchical-nested-DataList solution, but it seems
needlessly complex for a one-to-one relationship. Since the questions and
answers may come from different sources, I do not want to combine them.

Can anyone recommend a simple way to get both tables in the DataSet to
display in my data control? Or what am I missing?
 
The DataSet can't do implict joins, so there's no way to have it return you
a single table with the join. You'd have to do that back in your database
and load those results into a single table. The other thing is that you can
manually navigate the relationships via DataRow.GetChildRows (but it sounds
like you've been doing this).

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
I was afraid of that. I was hoping to be able to keep the questions part in
an XML file, but if I have to load it into the database to make this work
I'll do that.

Alternatively, do you think it would be more difficult would it be to
retrieve the answer data from the database into an XML document and merge it
with the questions XML? (I am still trying to figure out the best ways to do
things in .NET.)
 
Back
Top