Master/Detail dataset fill

  • Thread starter Alejandro Bibiano González
  • Start date
A

Alejandro Bibiano González

I hava a typed dataset with 2 tables and a relation (master/detail).

I have an dataadapter to fill the master table (with a select and a
parameter) and now I want fill the second table with another dataadapter,
but I don't know how I have to define the select sentence to populate it
only with the records that have relation with the master table.

How can I do this?

After filling the dataset, I insert a new row in the master table (it has an
autonumeric Key field simulate with sequences in Oracle), and then I insert
new rows in the detail table. How can I controll the update to insert the
autonumeric key genereted in the master table in the detail table?

A lot of thanks,

Alex B.
 
M

Mortos

Why do you need the DataAdapter to handle the 'JOIN' between the 2 set's
of data. Let the Database handle that. Since you are retrieving the
first set then the 2nd set should be possible via SQL. (Unless I'm way
off here and it has been known to happen)

-- 1st set
Select PlayerID, PlayerName from Player

-- 2nd Set
Select Frags.FragNum, Frags.ServerName
From Frags INNER JOIN Player ON Frags.PlayerID = Player.PlayerID

So the first table has the players while the second table has their frag
scores on various servers.


Q2:
Depends on how your table has been set up. ALthough I doubt it'l be up
to the application to set the ID's. If not, you can return the new ID's
via the DataAdpater's Insert command by setting up the appropriate
parameter objects and directions (Input/Output). Linking this parameter
object to a column would/should simply place the returned ID into said
column.
 
A

Alejandro Bibiano González

Thanks for the response, but I have a new question.

If I select only 2 Players in the 1st set:

Select PlayerID, PlayerName from Player where PlayerID in(3,8)

how can I set the 2nd set without passing this 2 parameters?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top