Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1280
  • Last Modified:

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

MVC 2 Entity framework 4 how do I execute an insert stored procedure and pass parameters?
0
jonatec
Asked:
jonatec
  • 3
  • 3
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
Are you using ADO.Net or Entity Framework, or something else, or do you not mind?
0
 
jonatecAuthor Commented:
Entity Framework
0
 
Carl TawnSystems and Integration DeveloperCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
jonatecAuthor Commented:
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
 
Carl TawnSystems and Integration DeveloperCommented:
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
 
jonatecAuthor Commented:
Yeah, that's excellent thanks !!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now