roypython
10-28-2006, 11:12 PM
Hello.
Your help is very much apperciated.
I am using SQL SERVER 2005, and framework 1.1.
I would like to create transaction, that:
inserts a record to one table1 -> selects the new record's PK(identity) ->
Inserts a record to table2, with FK (equals to the PK of table1).
Example:
Table1 (orders):
order ID (PK, identity)
Order Date
Table2(items ordered)
Item ID (PK)
OrderID (FK)
1. Insert a record to table1
2. Get the order ID (PK), of the new record, from table1.
3. Insert record into table2, using the order ID .
I don't know how to include SELECT in transactions.
Can it be done?
Thanks
Roy
Your help is very much apperciated.
I am using SQL SERVER 2005, and framework 1.1.
I would like to create transaction, that:
inserts a record to one table1 -> selects the new record's PK(identity) ->
Inserts a record to table2, with FK (equals to the PK of table1).
Example:
Table1 (orders):
order ID (PK, identity)
Order Date
Table2(items ordered)
Item ID (PK)
OrderID (FK)
1. Insert a record to table1
2. Get the order ID (PK), of the new record, from table1.
3. Insert record into table2, using the order ID .
I don't know how to include SELECT in transactions.
Can it be done?
Thanks
Roy