Click here to Skip to main content
15,884,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want use this store procedure in entity framwork

SQL
CREATE Procedure [dbo].[GetSood]
@datefrom nvarchar(15),
@dateto nvarchar(15)

as
SELECT Price,Numbers,PriceTotal FROM VW_Sale  WHERE DateCreate>=@datefrom and DateCreate<=@dateto  and IsSale=1 and PayType=2;


i add this procedure in model but when run show this error

C#
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:

C#
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();
        }</dal.vw_sale>
Posted
Updated 12-Aug-11 19:49pm
v2

1 solution

This problem usually arises when the cursor returned by stored procedure has a set of columns that differs from the set of view's columns.
The difference can be in names of these columns. Please check if the column name is the same in database and framework.
Check if your framework is updated sometimes Designer.cs will not update it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900