dbTalk Databases Forums  

how to insert one Parent and Multiple child records into SQL Serve

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss how to insert one Parent and Multiple child records into SQL Serve in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Hezal
 
Posts: n/a

Default how to insert one Parent and Multiple child records into SQL Serve - 04-15-2008 , 10:34 AM






Hi,
I have created 2 tables, Orders and Order Items. Using C# I am able to add
a single order and use that order's ID as an input for OrdersItems table to
insert one record within a Transaction.
But I need to have multiple order items for one order.

Please help, as I urgently need to solve my problem...
Thanks.


Reply With Quote
  #2  
Old   
Sean McCown
 
Posts: n/a

Default RE: how to insert one Parent and Multiple child records into SQL Serve - 05-23-2008 , 09:52 AM






I guess I don't understand. You have the new OrderID and you're using it to
populate another table already. Why can't you use it for all the other
populations as well?
Are you returning the new OrderID back to C#? Because that's your answer.
--
Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://weblog.infoworld.com/dbunderground/
DBA Rant – http://dbarant.blogspot.com




"Hezal" wrote:

Quote:
Hi,
I have created 2 tables, Orders and Order Items. Using C# I am able to add
a single order and use that order's ID as an input for OrdersItems table to
insert one record within a Transaction.
But I need to have multiple order items for one order.

Please help, as I urgently need to solve my problem...
Thanks.


Reply With Quote
  #3  
Old   
Sean McCown
 
Posts: n/a

Default RE: how to insert one Parent and Multiple child records into SQL Serve - 05-23-2008 , 09:52 AM



I guess I don't understand. You have the new OrderID and you're using it to
populate another table already. Why can't you use it for all the other
populations as well?
Are you returning the new OrderID back to C#? Because that's your answer.
--
Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://weblog.infoworld.com/dbunderground/
DBA Rant – http://dbarant.blogspot.com




"Hezal" wrote:

Quote:
Hi,
I have created 2 tables, Orders and Order Items. Using C# I am able to add
a single order and use that order's ID as an input for OrdersItems table to
insert one record within a Transaction.
But I need to have multiple order items for one order.

Please help, as I urgently need to solve my problem...
Thanks.


Reply With Quote
  #4  
Old   
Sean McCown
 
Posts: n/a

Default RE: how to insert one Parent and Multiple child records into SQL Serve - 05-23-2008 , 09:52 AM



I guess I don't understand. You have the new OrderID and you're using it to
populate another table already. Why can't you use it for all the other
populations as well?
Are you returning the new OrderID back to C#? Because that's your answer.
--
Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://weblog.infoworld.com/dbunderground/
DBA Rant – http://dbarant.blogspot.com




"Hezal" wrote:

Quote:
Hi,
I have created 2 tables, Orders and Order Items. Using C# I am able to add
a single order and use that order's ID as an input for OrdersItems table to
insert one record within a Transaction.
But I need to have multiple order items for one order.

Please help, as I urgently need to solve my problem...
Thanks.


Reply With Quote
  #5  
Old   
Sean McCown
 
Posts: n/a

Default RE: how to insert one Parent and Multiple child records into SQL Serve - 05-23-2008 , 09:52 AM



I guess I don't understand. You have the new OrderID and you're using it to
populate another table already. Why can't you use it for all the other
populations as well?
Are you returning the new OrderID back to C#? Because that's your answer.
--
Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://weblog.infoworld.com/dbunderground/
DBA Rant – http://dbarant.blogspot.com




"Hezal" wrote:

Quote:
Hi,
I have created 2 tables, Orders and Order Items. Using C# I am able to add
a single order and use that order's ID as an input for OrdersItems table to
insert one record within a Transaction.
But I need to have multiple order items for one order.

Please help, as I urgently need to solve my problem...
Thanks.


Reply With Quote
  #6  
Old   
Sean McCown
 
Posts: n/a

Default RE: how to insert one Parent and Multiple child records into SQL Serve - 05-23-2008 , 09:52 AM



I guess I don't understand. You have the new OrderID and you're using it to
populate another table already. Why can't you use it for all the other
populations as well?
Are you returning the new OrderID back to C#? Because that's your answer.
--
Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://weblog.infoworld.com/dbunderground/
DBA Rant – http://dbarant.blogspot.com




"Hezal" wrote:

Quote:
Hi,
I have created 2 tables, Orders and Order Items. Using C# I am able to add
a single order and use that order's ID as an input for OrdersItems table to
insert one record within a Transaction.
But I need to have multiple order items for one order.

Please help, as I urgently need to solve my problem...
Thanks.


Reply With Quote
  #7  
Old   
Sean McCown
 
Posts: n/a

Default RE: how to insert one Parent and Multiple child records into SQL Serve - 05-23-2008 , 09:52 AM



I guess I don't understand. You have the new OrderID and you're using it to
populate another table already. Why can't you use it for all the other
populations as well?
Are you returning the new OrderID back to C#? Because that's your answer.
--
Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://weblog.infoworld.com/dbunderground/
DBA Rant – http://dbarant.blogspot.com




"Hezal" wrote:

Quote:
Hi,
I have created 2 tables, Orders and Order Items. Using C# I am able to add
a single order and use that order's ID as an input for OrdersItems table to
insert one record within a Transaction.
But I need to have multiple order items for one order.

Please help, as I urgently need to solve my problem...
Thanks.


Reply With Quote
  #8  
Old   
Sean McCown
 
Posts: n/a

Default RE: how to insert one Parent and Multiple child records into SQL Serve - 05-23-2008 , 09:52 AM



I guess I don't understand. You have the new OrderID and you're using it to
populate another table already. Why can't you use it for all the other
populations as well?
Are you returning the new OrderID back to C#? Because that's your answer.
--
Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://weblog.infoworld.com/dbunderground/
DBA Rant – http://dbarant.blogspot.com




"Hezal" wrote:

Quote:
Hi,
I have created 2 tables, Orders and Order Items. Using C# I am able to add
a single order and use that order's ID as an input for OrdersItems table to
insert one record within a Transaction.
But I need to have multiple order items for one order.

Please help, as I urgently need to solve my problem...
Thanks.


Reply With Quote
  #9  
Old   
Sean McCown
 
Posts: n/a

Default RE: how to insert one Parent and Multiple child records into SQL Serve - 05-23-2008 , 09:52 AM



I guess I don't understand. You have the new OrderID and you're using it to
populate another table already. Why can't you use it for all the other
populations as well?
Are you returning the new OrderID back to C#? Because that's your answer.
--
Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://weblog.infoworld.com/dbunderground/
DBA Rant – http://dbarant.blogspot.com




"Hezal" wrote:

Quote:
Hi,
I have created 2 tables, Orders and Order Items. Using C# I am able to add
a single order and use that order's ID as an input for OrdersItems table to
insert one record within a Transaction.
But I need to have multiple order items for one order.

Please help, as I urgently need to solve my problem...
Thanks.


Reply With Quote
  #10  
Old   
Sean McCown
 
Posts: n/a

Default RE: how to insert one Parent and Multiple child records into SQL Serve - 05-23-2008 , 09:52 AM



I guess I don't understand. You have the new OrderID and you're using it to
populate another table already. Why can't you use it for all the other
populations as well?
Are you returning the new OrderID back to C#? Because that's your answer.
--
Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://weblog.infoworld.com/dbunderground/
DBA Rant – http://dbarant.blogspot.com




"Hezal" wrote:

Quote:
Hi,
I have created 2 tables, Orders and Order Items. Using C# I am able to add
a single order and use that order's ID as an input for OrdersItems table to
insert one record within a Transaction.
But I need to have multiple order items for one order.

Please help, as I urgently need to solve my problem...
Thanks.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.