0

i have defiend a simple stored procedure which updates a column value, this stored procedure is called when a record is inserted in another table(table A). I have mapped the stored procedure onto the target table(table A) in the edmx file. Now the stored procedure is successfully called and the value in the table(table B) is updated but the actual record is not inserted in the database in table A.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
John x
  • 4,031
  • 8
  • 42
  • 67
  • How did you map? And how did you call them in your code? – Akash Kava Jan 18 '12 at 08:08
  • @AkashKava i didn't call it in the code just mapped it using the designer, right click on the `entity>stored procedure mapping >add the stored procedure to be callled on insert in that table` i have also added the `SP` onto the designer... – John x Jan 18 '12 at 08:13
  • @AkashKava can you guide me how can i call it in the code because in the mapping it is specified to call the procesure on insert, i have followed this post but to no avail http://stackoverflow.com/questions/6219643/how-to-call-stored-procedure-in-mvc-by-ef – John x Jan 18 '12 at 08:49

1 Answers1

0

Once you map stored procedure to insert operation for TableA you are overwriting insert functionality (it is not pre or post insert operation). The stored procedure is called instead of normal SQL insert so the stored procedure must do both insert to TableA and update in TableB. If it does only update in TableB the record to TableA will never be inserted.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670