Solved

MVC 2 Entity framework 4 how do I execute an insert stored procedure

Posted on 2010-11-08
6
1,259 Views
Last Modified: 2013-11-08
MVC 2 Entity framework 4 how do I execute an insert stored procedure and pass parameters?
0
Comment
Question by:jonatec
  • 3
  • 3
6 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34086418
Are you using ADO.Net or Entity Framework, or something else, or do you not mind?
0
 

Author Comment

by:jonatec
ID: 34088344
Entity Framework
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34088390
You should be able to add a stored procedure to your model when you are defining it, in the same way that you would with a table.

For further reading check these:

    http://msdn.microsoft.com/en-us/library/bb896279.aspx
    http://learnentityframework.com/LearnEntityFramework/tutorials/using-stored-procedures-for-insert-update-amp-delete-in-an-entity-data-model/
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:jonatec
ID: 34091589
Thanks. At the Microsoft url you gave there is a comment:

"If you do not map all three of the insert, update, and delete operations  of an entity type to stored procedures, the unmapped operations will  fail if executed at runtime, and an UpdateException will be thrown."

Do you know how to set up just one stored procedure for an insert and not set up sprocs for update and delete ?
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 34091621
All that is basically saying is that if you don't map the SELECT or UPDATE, but then attempt to Select or Update that model then the calls will fail because there will be no mapping.

As long as you understand that, and don't attempt a Select or Update, then you should be ok.
0
 

Author Closing Comment

by:jonatec
ID: 34092767
Yeah, that's excellent thanks !!!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now