Solved

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

Posted on 2010-11-08
6
1,264 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

776 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