views:

290

answers:

1

I've got a SQL Server function that returns a scalar BIT value and takes one parameter. The following gives you an idea:

CREATE FUNCTION dbo.[fnTest] (@StringToTest VARCHAR(10)) 
RETURNS BIT 
AS
BEGIN 
    DECLARE @b BIT 
    IF @StringToTest = 'A' SET @b = 0 ELSE SET @b = 1
    RETURN (@b) 
END
GO

Being very new (days!) to SubSonic - how would I call this using SubSonic?

(I'm using a web site with the basic "subsonic.abp" file with an asterisk in it).

+1  A: 

Got it!

Here's how in VB:

Return New SubSonic.InlineQuery().ExecuteScalar(Of Boolean)("SELECT dbo.[fnTest](@StringToTest)", StringToTest)

Thanks all, hope this helps someone else,

Thomas

thomasswilliams
or `CodingHorror()` instead of `InlineQuery()` if he uses subsonic 3
SchlaWiener