Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created 3 tables like tblA, tblB, tblC
field are
tblA:
CharityId(PK) Name EmailId CategryId(FK)
1 abc abc@gmail.com 1
2 lmn lmn@gmail.com 1
3 pqr ssd@gmail.com 2
4 abc sss@gmail.com 3
tblB:
CategoryId(PK) Name
1 cat1
2 ca2
3 ca3
4 cat4
tblC:
CharityId(FK) CategryId(FK)
1 1
1 2
2 1
2 2
2 3

My intention is i when i want to insert data from view that will inserted to more than one tables like above and charityid and categoryid inserted into separate table like tblC.
How can i do this by using MVC3 with edm(stored procedures).

I have searched so many sites but no one can resolve this.
so please provide solution
Posted

1 solution

Hi,

In your SP itself you can insert data into 3 tables...
please follow the below syntax.

SQL
CREATE PROCEDURE XXXX
(
@Trans_Type VARCHAR(100),
--add your parameters---
)
AS
BEGIN
   IF @Trans_Type='INSERT-A'
       ---- INSERT DATA INTO tblA
   ELSE IF @Trans_Type='INSERT-B'
       ---- INSERT DATA INTO tblB
   ELSE IF @Trans_Type='INSERT-C'
       ---- INSERT DATA INTO tblC
END

you can do like this also....

I think it might be help for you....
 
Share this answer
 

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