Solved

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

Posted on 2010-11-08
6
1,267 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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