我有一个存储过程,用于更新员工详细信息,如下所示。
我尝试从模型浏览器中删除存储过程,然后再次将其添加回去,还尝试运行自定义工具。
ALTER PROCEDURE proc_EmployeeDetails_Update
@EmpId INT,
@EmpCountryId INT,
@EmpDepId INT
AS
BEGIN
BEGIN TRY
BEGIN TRANSACTION EmpUpdate;
// sql logic to update
COMMIT TRANSACTION EmpUpdate;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION EmpUpdate;
SELECT ERROR_NUMBER() AS ErrorNumber,
ERROR_STATE() AS ErrorState;
END CATCH;
END
GO
C#代码:
Var result = EMPDB.proc_EmployeeDetails_Update(5345, 21, 35); -- This is the line which is throwing the error.
public partial class proc_EmployeeDetail_Update_Result
{
public Nullable<int> ErrorNumber { get; set; }
public Nullable<int> ErrorState { get; set; }
}
错误:
数据读取器与指定的“ EmployeeModel.proc_EmployeeDetail_Update_Result”不兼容。类型“ ErrorNumber”的成员在数据读取器中没有具有相同名称的对应列。