Link to home
Start Free TrialLog in
Avatar of jonatec
jonatecFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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?
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Are you using ADO.Net or Entity Framework, or something else, or do you not mind?
Avatar of jonatec

ASKER

Entity Framework
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/ 
Avatar of jonatec

ASKER

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 ?
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jonatec

ASKER

Yeah, that's excellent thanks !!!