cmd.ActiveConnection = cn
        cmd.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc
        cmd.CommandText = "sp_login"
        cmd.Parameters.Append( _
        cmd.CreateParameter("result", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamOutput))
        cmd.Parameters.Append( _
        cmd.CreateParameter("user", ADODB.DataTypeEnum.adVarChar, ADODB.ParameterDirectionEnum.adParamInput, 15, TextBox1.Text))
        cmd.Parameters.Append( _
        cmd.CreateParameter("passuser", ADODB.DataTypeEnum.adVarChar, ADODB.ParameterDirectionEnum.adParamInput, 15, TextBox2.Text))

        rs.Open(cmd, , ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
        If rs.Fields!result.Value = 1 Then
            AddProduct.Show()
        Else
            MsgBox("Your Username or Password is Incorrect", MsgBoxStyle.Information, "AEB Gasul System")
            Exit Sub
        End If

this is my stored procedure code

CREATE PROCEDURE sp_login
(
@user varchar(15),
@passuser varchar(15),
@result integer OUTPUT
)
AS

if exists (select userlogin, pass from dbo.tbl_login where userlogin = @user and pass = @passuser)
begin
	Select 1 as result
	
end
GO

how can i get the result value in stored procedure?

Use output parameters..
like declare @result int
@result output.
In ADO.net method also u need to have one variable of same data type. and u have to use parameter.direcection method.

thank you for your reply :) but can you put the whole code on how to do that? :) i'm new in adodb stored procedure i always use sql command.

CREATE PROCEDURE [dbo].[pr_OutputPara,]            
                (            
                @test as varchar(10) 
                @out VARCHAR(10) OUTPUT          
                )            
AS  
BEGIN 
--Write  your business logic here
Select @out 
END

This is at the sp level..
In ado .net code

Dim output as string""
command.Parameters.Add("@Out", SqlDbType.VarChar, 10).Direction = ParameterDirection.Output
'After execution of query
 output = command.Parameters("@out").Value.ToString
This article has been dead for over six months. Start a new discussion instead.