469,647 Members | 1,784 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

how to fill typed dataset with joined queries ?

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.

Nov 19 '05 #1
1 3027
You need to make your mind what you want. If you want to work against 2
tables, you have to run 2 separate queries, like you write. You can't fill 2
tables from one select query. You can do it with a stored procedure or a
batch query that return 2 recordsets.

You may decide that you need only one table. For example, if you want to
show both user and user role fields in the same grid. Than you should make
just one table that will contain fields from the joined select.

Eliyahu

"Ersin Gençtürk" <ers[spam]@gencturk.org> wrote in message
news:ef**************@TK2MSFTNGP15.phx.gbl...
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.


Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by suzy | last post: by
3 posts views Thread by MC D | last post: by
2 posts views Thread by Stanav | last post: by
1 post views Thread by Nikolay Petrov | last post: by
5 posts views Thread by moondaddy | last post: by
4 posts views Thread by Andre | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.