Click here to Skip to main content
12,448,563 members (54,121 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# SQL-Server SQL-Server-2008 , +
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 21:10pm
DGKumar958

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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160811.3 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2016
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