Android Question How to get output value after from stored procedure?

gacar

Active Member
How can i get stored procedure output value after run (JdbcSQL)?

B4X:
Private Sub CreateUser
    Dim arr As List
    Dim Ad As String = "[email protected]"
    arr.Initialize
    arr.Add(Ad)
    Dim obj As Object = SQL.CreateCallStatement("dbo.MobilMisafirOlustur(?)",arr) 
    Dim rs As JdbcResultSet= SQL.ExecCall(obj) 'Success run stored procedure
    Dim IndexofColumn As Int = rs.ColumnCount 'I am getting 1
    Dim ColumnName As String = rs.GetColumnName(0)  'I am getting "UserName" (this is right)
    Dim OutPutValueWithIndex As String = rs.GetString2(0) '<<<<< I am getting error "java.sql.SQLException: No current row in the ResultSet."
    Dim OutPutValueWithName As String = rs.GetString(ColumnName) '<<<<< I am getting error "java.sql.SQLException: No current row in the ResultSet."
End Sub
 
Solution
I am getting error "java.sql.SQLException: No current row in the ResultSet

You need to move to the 1st record to see the results:
B4X:
If rs.NextRow Then
        Dim OutPutValueWithIndex As String = rs.GetString2(0) 
        Log(OutPutValueWithIndex)
        Dim OutPutValueWithName As String = rs.GetString(ColumnName)
        Log(OutPutValueWithName)
End If

Mahares

Expert
Licensed User
Longtime User
I am getting error "java.sql.SQLException: No current row in the ResultSet

You need to move to the 1st record to see the results:
B4X:
If rs.NextRow Then
        Dim OutPutValueWithIndex As String = rs.GetString2(0) 
        Log(OutPutValueWithIndex)
        Dim OutPutValueWithName As String = rs.GetString(ColumnName)
        Log(OutPutValueWithName)
End If
 
Upvote 0
Solution

gacar

Active Member
You need to move to the 1st record to see the results:
B4X:
If rs.NextRow Then
        Dim OutPutValueWithIndex As String = rs.GetString2(0)
        Log(OutPutValueWithIndex)
        Dim OutPutValueWithName As String = rs.GetString(ColumnName)
        Log(OutPutValueWithName)
End If
Finally worked. Thank you very much.
 
Upvote 0
Top