Relation between 2 table

G

Guest

Lets say i've 2 table. Order and OrderDetail.

Order table is contain OrderNo(PK), OrderName.
orderDetail contain orderDetailID(PK), OrderNo(FK), item and qty.

and i had finish related the two of table in dataset. Is it possible that
the value of orderNo (from orderDetail table) insert automatically from his
foreign key (Order.OrderNo) ?

Thanks.
 
M

Miha Markic [MVP C#]

Hi Seth,

I am not sure I understand you completly.
Can you explain in more details what do you mean by
"inserrt automatically from his foreign key (Order.OrderNo) "
 
M

Miha Markic [MVP C#]

Are you talking about UI or code - how are you inserting rows?
If you are inserting by code then you shouldn't have problems passing
OrderNo from Order table as you have to know it.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Seth Bourne said:
Hi Miha,
The orderDetail Table consist foreign key from Order table. The coloumn
name is OrderNo (orderDetail.OrderNo).
if i'm insert 1 row into orderDetail, is it possible to automatically
update the orderNo from orderDetail table, same as the orderNo from Order
table ?
the mean 'automatically' it's mean we dont have to code anything, just
related it to the dataset relation.

|-----------------------| |------------------------------|
| Order | |
OrderDetail |
|-----------------------| |------------------------------|
| OrderNo (PK) | -----------------| | OrderDetailID (PK)
|
| OrderName | |----- | OrderNo
(FK) |
|-----------------------| | Item |
|
qty |

|------------------------------|


Miha Markic said:
Hi Seth,

I am not sure I understand you completly.
Can you explain in more details what do you mean by
"inserrt automatically from his foreign key (Order.OrderNo) "

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Seth Bourne said:
Lets say i've 2 table. Order and OrderDetail.

Order table is contain OrderNo(PK), OrderName.
orderDetail contain orderDetailID(PK), OrderNo(FK), item and qty.

and i had finish related the two of table in dataset. Is it possible
that
the value of orderNo (from orderDetail table) insert automatically from
his
foreign key (Order.OrderNo) ?

Thanks.
 
S

Seth Bourne

Hi Miha,
The orderDetail Table consist foreign key from Order table. The coloumn name
is OrderNo (orderDetail.OrderNo).
if i'm insert 1 row into orderDetail, is it possible to automatically update
the orderNo from orderDetail table, same as the orderNo from Order table ?
the mean 'automatically' it's mean we dont have to code anything, just
related it to the dataset relation.

|-----------------------|
|------------------------------|
| Order | |
OrderDetail |
|-----------------------|
|------------------------------|
| OrderNo (PK) | -----------------| | OrderDetailID (PK)
|
| OrderName | |----- | OrderNo (FK)
|
|-----------------------| | Item
|
|
qty |
|------------------------------|


Miha Markic said:
Hi Seth,

I am not sure I understand you completly.
Can you explain in more details what do you mean by
"inserrt automatically from his foreign key (Order.OrderNo) "

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Seth Bourne said:
Lets say i've 2 table. Order and OrderDetail.

Order table is contain OrderNo(PK), OrderName.
orderDetail contain orderDetailID(PK), OrderNo(FK), item and qty.

and i had finish related the two of table in dataset. Is it possible that
the value of orderNo (from orderDetail table) insert automatically from
his
foreign key (Order.OrderNo) ?

Thanks.
 

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