dataset relations

C

Cdude

I have three datatables in my dataset firstly a products then a
stocklink then a stock table. Now i have linked products table to a
datagrid and the stock. The stock link table joins these 2 tables
together i have a relationship between products and stocklink and i
have a relationship between stocklink and stock. Now when i change the
selection of the product i want all the stockitems linked to that
product to display in the grid linked to stock datatable. One product
might be linked to many stock items. At the moment whenever i change
the product it only displays one of the linked items not all of them i
need them all.
 
I

Ignacio Machin ( .NET/ C# MVP )

I have three datatables in my dataset firstly a products then a
stocklink then a stock table. Now i have linked products table to a
datagrid and the stock. The stock link table joins these 2 tables
together i have a relationship between products and stocklink and i
have a relationship between stocklink and stock. Now when i change the
selection of the product i want all the stockitems linked to that
product to display in the grid linked to stock datatable. One product
might be linked to many stock items. At the moment whenever i change
the product it only displays one of the linked items not all of them i
need them all.

and your question is?
 
C

Cdude

example my product code is 22

in the stocklink table is prodcode;stockcode;qty
22 8888 1
22 9999 2

in the stock table code; desc ;qty
8888 item1 12
9999 item2 10

now when i select product with code 22 i want to display item1 and
item2 in a grid
 
I

Ignacio Machin ( .NET/ C# MVP )

How do i display them all

display them where?

You can use several controls for it, like a grid, a tree, etc

also is this a web or a win app?
 
I

Ignacio Machin ( .NET/ C# MVP )

Is that i cant display all the stock items linked to a product

very easy, if you have a FK relationship you can use
DataRow.GetChildRows()
if not you can create a dataview of the child table
 

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