Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling a Scalar Function from SubSonic

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).

like image 726
thomasswilliams Avatar asked Jun 20 '26 11:06

thomasswilliams


1 Answers

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

like image 163
thomasswilliams Avatar answered Jun 24 '26 04:06

thomasswilliams



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!