chetan shinde

chetan shinde

  • NA
  • 108
  • 45.7k

MVC Database fetching error

Sep 1 2017 8:00 AM
 
 
i am writing Storeprocedure 
 
 
CREATE PROCEDURE sp_Players_GetWithDrawDtls
-- Add the parameters for the stored procedure here
@userId int,
@fromDt datetime,
@toDt datetime,
@status nvarchar(10),
@type nvarchar(10)
AS
BEGIN
if(@type = 'Withdraw')
begin
select Pc.UserId,(select sum(Amount) from tblPlayerCreditWithdrawaDetails where UserId = @userId and Reqdate between @fromDt and @toDt and Status = 'A') as ApprovedAmount,
(select sum(Amount) from tblPlayerCreditWithdrawaDetails where UserId = @userId and Reqdate between @fromDt and @toDt and Status = 'C') as PendingAmount
from tblPlayerCreditWithdrawaDetails PC
group by pc.UserId
end
else
begin
select Pc.UserId,pc.Reqdate,pc.Amount,pc.Status,pc.Reason,pc.Actiondate
from tblPlayerCreditWithdrawaDetails PC
where UserId = @userId
and Reqdate between @fromDt and @toDt
and Status = @status
end
END
 
but when i am trying to bind data like :- 
var query = db.sp_Players_GetWithDrawDtls(objWithDrawReq.userId, objWithDrawReq.fromDt, objWithDrawReq.toDt, objWithDrawReq.status, "WithdrawReq").ToList();
 
but it gives me error that
 

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


please help me for the same.  
 

Answers (1)