KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using Entity Framework 4.1 and do sometimes need to call stored procedures. Some of these return ints as return values. For instance CREATE PROCEDURE ... ... INSERT INTO ... SELECT @@Identity ( Update : removed return value, not relevant. We're returning the identity) I have the following code in my respository class: var orderNo = context.Database.SqlQuery<int>("EXEC myProc").Single(); This fails with the error message The specified cast from a materialized 'System.Decimal' type to the 'System.Int32' type is not valid. If I change the code above to var orderNo = context.Database.SqlQuery<decimal>("EXEC myProc").Single(); everything works. Now, I think that I should be able to return an int. What's the proper way to do this?
Tags (comma-separated)
Save Edits
Cancel