Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
More EF Perplexities
Message
General information
Forum:
ASP.NET
Category:
Entity Framework
Environment versions
Environment:
C# 5.0
OS:
Windows 10
Network:
Windows Server 2016
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01646576
Message ID:
01646586
Views:
29
Hi Borislav,

You're right. But it ran ok in ssms. I corrected it and it still returns the same result from c#

Thanks for caring.

Marc

>>Must have missed something:
>>
>>
>>I have this test routine :
>>
>>
>>       public static void Test_EXP_0071TAttached()
>>        {
>>            using (var context = new PluczExp_PluczContext(Config.model.SqlServer))
>>            {
>>                var sql = "dbo.Exp_0071TAttached";
>>                var attached = context.Database.SqlQuery<string>(sql).ToString();
>>                Console.WriteLine($"EXP_0071TAttached returns {attached}");
>>            }
>>        }
>>
>>
>>... that returns :" EXP_0071TAttached returns dbo.Exp_0071TAttached."
>>
>>Here's the scalar returning function :
>>
>>
>>USE [Exp_Plucz]
>>GO
>>SET ANSI_NULLS ON
>>GO
>>SET QUOTED_IDENTIFIER ON
>>GO
>>ALTER FUNCTION [dbo].[Exp_0071TAttached]()
>>RETURNS int
>>AS
>>begin
>>	declare @result bit = 0
>>	select @result = CAST(
>>		CASE WHEN DB_Id('EXP_0071T') is not null THEN 1
>>		ELSE 0
>>		END
>>	AS BIT)
>>	RETURN @RESULT 
>>END
>>
>
>You declared that the function returns integer but you return bit instead.
>
>RETURNS int
>
>declare @result bit = 0

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Previous
Reply
Map
View

Click here to load this message in the networking platform