Modify your stored procedure as follows, The below piece of code will help you...
ALTER PROCEDURE [dbo].[sp_getUserAccess]
(
@UserName varchar (25),
@Password varchar (25),
@Result varchar(5) output
)
AS
BEGIN
SET NOCOUNT ON;
IF (select AccessWord from UserAccess where UserName='%@UserName%' AND AccessWord ='%@Password%') = @Password
set @Result='One'
ELSE
set @Result='Zero'
END
Now, Execute the above procedure as follows:
declare @CheckUserAccess varchar(5)
Execute [dbo].[sp_getUserAccess] 'Username Here','Password Here',@result = declare @CheckUserAccess output
print @CheckUserAccess
Example:
declare @CheckUserAccess varchar(5)
Execute [dbo].[sp_getUserAccess] 'Dipesh','121',@result = declare @CheckUserAccess output
print @CheckUserAccess
The above example will print
ONE if username and password
EXIST in table.
The above example will print
ZERO if username and password
DOES NOT EXIST in Table.