There is a function in MS SQL SERVER 2012 EXPRESS like below.
CREATE FUNCTION [dbo].[fnCheckClientAppVersion](@Version AS NVARCHAR(15))
RETURNS INT
AS
BEGIN
DECLARE @VRS AS NVARCHAR(15);
SET @VRS = (SELECT [Value] FROM Options WHERE [Key] = 'ClientAppVersion');
IF @Version = @VRS
RETURN 1;
RETURN 0;
END
And I try to use call this function in my C# Code like below.
SqlCommand command = new SqlCommand();
command.Connection = Globals.Connection;
command.CommandText = "dbo.fnCheckClientAppVersion";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@Version", "1.0.0.0"));
object o = command.ExecuteScalar();
But everytime when i run this code, the value of o is null.
Why?
What is the Problem?