MVC C#Entity Framework错误:数据读取器与指定的不兼容

时间:2012-09-11 22:51:59

标签: c# asp.net-mvc-3 entity-framework stored-procedures

调用以下存储过程后出现错误:

var result = db.APP_Client_Update(clientID,[and other parameters here]).ToList();

错误:

The data reader is incompatible with the specified 
'ClientModel.APP_Client_Update_Result'. 
A member of the type, 'retcode', does not have a corresponding 
column in the data reader with the same name.

存储过程返回以下内容: 如果我找不到记录那么......

If @WorkflowID is null or not exists 
(Select 1 from Clients_Changes where ClientID = @ClientID)
BEGIN
    Select '-999' as retcode, 
'Unable to update client record, something is wrong' as retmessage
    Return 0
END

如果成功......

IF @@TRANCOUNT > 0 
BEGIN
COMMIT TRANSACTION
Select '1' as retcode, 'Client Updated Successfully' as retmessage 
END

我到处寻找解决方案,但似乎找不到一个,我确保我的mvc解决方案中的所有返回类型都与retcode和retmessage完全匹配。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

运行SQL事件探查器后,问题出现在存储过程中我能够缩小错误范围。