How can be call a SQL function which takes two parameters? I want memorize the returning value in a variable.
The function is:
CREATE FUNCTION [CheckPwd]( @User nvarchar(50), @Pwd nvarchar(50))
RETURNS int
AS
BEGIN
DECLARE @RES int
DECLARE @PWD_DB varbinary(255)
IF (@User is not null and @User != '' and @Pwd is not null and @Pwd != '' )
begin
SELECT @PWD_DB = password FROM UserTable WHERE username = @User
SET @PwdRES = pwdcompare(@Pwd, @PWD_DB )
end
ELSE
SET @PwdRES = 0
RETURN @RES
END
Here’s an example with a stored-procedure, with plain SQL it’s similar.
SqlCommand.ExecuteScalarMethod