c# - Entity Framework stored procedure return type changed -
i update data model deleting .edmx file , adding again, make sure have in database.
i ran strange issue, 1 of stored procedure return types has been changed after deleting , re-adding .edmx. stored procedure code remains unchanged, , can found below. not sure wrong did?
sql server stored procedure (never changed):
set ansi_nulls on go set quoted_identifier on go alter procedure [dbo].[usp_searchorders] @orderid int = null, @statusid int = null, @startdate datetime = null, @enddate datetime = null, @customername varchar(30) = null, @customeraddress varchar(30) = null select o.orderid order_id, o.orderdate, ordertotal = (select sum(od.unitprice - (od.unitprice * od.discount)) [order details] od od.orderid = o.orderid), discount = (select sum(od.unitprice * od.discount) [order details] od od.orderid = o.orderid), cc.email1, cc.phone, status = (select os.orderstatusname orderstatus os os.orderstatusid = o.orderstatusid), ordertype = (select ot.ordertypename ordertype ot ot.ordertypeid = o.ordertypeid) orders o join customers c on o.customerid = c.customerid join customerscontactdetails cc on c.customerid = cc.customerid (o.orderid = @orderid or @orderid null) , (o.orderstatusid = @statusid or @statusid null) , (o.orderdate >= @startdate or @startdate null) , (o.orderdate <= @enddate or @enddate null) , (c.customername @customername or @customername null) , (cc.address @customeraddress or @customeraddress null) , (cc.city @customeraddress or @customeraddress null) c# code: _dbcontext.usp_searchorders(1,1,datetime.now, datetime.now.adddays(1),'hitin','bh');
before update return type: usp_searchorders_result
after re-adding return type: int
i never made complex type or did mapping, class usp_searchorders_result created on own.
what possible reason behind issue?
you need have "set nocount on" @ top of stored procedure.
Comments
Post a Comment