Android Question How to get stored procedure output value with JdbcSQL?

gacar

Active Member
I am using JdbcSQL in my project.

I need stored procedure output value. Below code working well (Insert to table new record) without error but i couldn't get my stored procedure output value.

B4X:
Private Sub MisafirOlustur
 
    Dim MyResults As Map
    Dim MyResultSet As ResultSet
    Dim MSSQLProcedure As CallProc  
    MSSQLProcedure.ProcedureCall = "{call dbo.MobilMisafirOlustur()}"  
    MSSQLProcedure.ExecProcedure(SQL)
    MyResultSet  = MSSQLProcedure.FetchResultSet 
     
    If MSSQLProcedure.FetchMoreResults Then
        MyResultSet = MSSQLProcedure.FetchResultSet 
    End If
 
    MSSQLProcedure.close
End Sub

My Sp is

B4X:
ALTER PROCEDURE [dbo].[MobilMisafirOlustur] 
 
AS 
BEGIN
DECLARE @Username varchar(30)  
DECLARE @UserId int, @Deger varchar(30) 
BEGIN TRANSACTION 
    SET NOCOUNT ON;
SELECT TOP 1 @UserId = [UserID] FROM [dbo].[User]  ORDER BY UserID DESC ;  
SET @Deger = @UserId + 1
SET @Username = 'Misafir_' + @Deger 

INSERT INTO [dbo].[User]([Username],[SessionId],[IP],[Aktif],[Engelli])
     VALUES
           (@Username, @Username, @Username, 1, 0 )
COMMIT TRANSACTION 

SELECT @Username AS UserName
END
 
Top