Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have two tables like
Emp and Order

In Emp table:
Eid int pk,
EName varchar(50),
EAddress varchar(50).

and In Order table:
Oid int pk
OProduct varchar(50),
Eid int fk


Now i have two page like Emp.aspx and Products.aspx

So now i want to insert the value to both pages by passing Same Eid pk(Emp.aspx) value to Eid fk in (Products.aspx)...
Please help me how to pass the value from one page to another without missing the value


Thanks in Advance
Posted
Comments
Maciej Los 4-Aug-15 9:10am    
What database provider?

Start by creating a Transaction.
Then insert the primary table row.
Then use @@IDENTITY[^] to insert the second table values.
COMMIT the transaction.

The exact procedure for doing this depends on where you are doing it: in your C# code or via an SQL stored procedure (Each method has its adherents).
 
Share this answer
 
Comments
Maniteja.Vegi 6-Aug-15 13:33pm    
Will you please be in detailed...?
 
Share this answer
 
Comments
Maniteja.Vegi 6-Aug-15 13:36pm    
I'm asking you... How to pass the PK value from 1st page and 2nd page then value will be saved in to Fkey .... please be in detailed

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900