I want use this stored procedure in Entity Framework
CREATE Procedure [dbo].[GetSood]
@datefrom nvarchar(15),
@dateto nvarchar(15)
AS
SELECT Price, Numbers, PriceTotal
FROM VW_Sale
WHERE DateCreate >= @datefr开发者_开发知识库om
AND DateCreate <= @dateto
AND IsSale = 1
AND PayType = 2;
I add this procedure in the model but when run show this error
The data reader is incompatible with the specified 'AriaSalesmanagmentModel.VW_Sale'. A member of the type, 'ID', does not have a corresponding column in the data reader with the same name.
and my code is:
public List<DAL.VW_Sale> GetSood(string dateFrom, string dateTo)
{
DAL.AriaSalestEntities objAria = new AriaSalestEntities();
var sood = from s in objAria.GetSood(dateFrom, dateTo) select s;
return sood.ToList();
}
please help me?
If your entity is based on all the columns in VW_Sale, then you need to have SELECT * FROM VW_Sale
I would also recommend you not pass dates as strings - and certainly not as nvarchar.
精彩评论