Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 27-Jan-13 22:10pm
DGKumar759

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
In your SP itself you can insert data into 3 tables...
please follow the below syntax.
 
 
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....
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,192
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100