Home All Groups Group Topic Archive Search About

Relation between 2 table

Author
14 Dec 2006 12:34 AM
Seth Bourne
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.

Author
14 Dec 2006 7:48 AM
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) "

--
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/

Show quote
"Seth Bourne" <Seth Bou***@discussions.microsoft.com> wrote in message
news:0490145A-2944-4147-BBB4-839B4C1356CC@microsoft.com...
> 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.
Author
15 Dec 2006 2:49 AM
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                                       |
Show quote
                                                                        |------------------------------|


"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:4F692A43-0E71-43D8-965F-4C1B744AA635@microsoft.com...
> 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" <Seth Bou***@discussions.microsoft.com> wrote in message
> news:0490145A-2944-4147-BBB4-839B4C1356CC@microsoft.com...
>> 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.
>
Author
14 Dec 2006 12:17 PM
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/

Show quote
"Seth Bourne" <seth***@yahoo.com> wrote in message
news:e2UJcY3HHHA.1912@TK2MSFTNGP03.phx.gbl...
> 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 [MVP C#]" <miha at rthand com> wrote in message
> news:4F692A43-0E71-43D8-965F-4C1B744AA635@microsoft.com...
>> 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" <Seth Bou***@discussions.microsoft.com> wrote in message
>> news:0490145A-2944-4147-BBB4-839B4C1356CC@microsoft.com...
>>> 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.
>>
>
>

AddThis Social Bookmark Button