how to fill typed dataset with joined queries ?

  • Thread starter Thread starter Ersin Gençtürk
  • Start date Start date
E

Ersin Gençtürk

hi ,

I have 2 tables , tUser and tUserRole and I have a query like :

select * from tUser inner join tUserRole on tUserRole.UserId=tUser.UserId
where tUser.UserId=1

this will return a user with associated roles.

Also I have a typed dataset with two tables inside : tUser and tUserRole

how can I use this typed dataset when I use the query above ? What is the
expected behaviour ? Should I fill
two tables of the dataset with seperate queries like :

select * from tUser where UserId=1
select * from tUserRole where UserId=1

or is there any other better way ? I wonder because there are more complex
joined queries from database.I have to map them to the dataset.
 
Hi Ersin,

Depends on what do you want.
You can create a dataset with a single datatable that will hold all fields
from a join select. It won't be trivial storing it back to database if you
need to.
Or you can have two tables and fill them separatly (just like you proposed).
This way it is easier to persist them back to database.
 
Back
Top