Entity Framework - stored procedure return value

前端 未结 5 984
别那么骄傲
别那么骄傲 2020-11-28 11:15

I am trying to get the return value of a stored procedure. Here is an example of such a stored procedure:

select
    Name,
    IsEnabled
from
    dbo.somethi         


        
5条回答
  •  孤独总比滥情好
    2020-11-28 11:55

    In order to get the interested result in EF, you should return a same structure (not 1 and Name, IsEnabled) In this query you should return '',0 for example instead of 1 in the if condition:

    select
        Name,
        IsEnabled
    from
        dbo.something
    where
        ID = @ID
    
    if @@rowcount = 0
        return '',0
    

提交回复
热议问题