Hello,
I am trying to call a stored procedure in SQL server database, and the stored procedure returns more than one table
Like
select * from table1
select * from table2
select * from table...n
When the resultset returns It looks like having only the first table in the Crsr object.
What should I do if I have more than one table (E.g. Passenger, and His list of payments).
I had to split what I want into 2 different calls each returns one table / query... but I feel it is not efficient. Here is my example Code (It is just trials and not having complete meaning).
Also I have another question that could be related: Is there a way to do the calls to the database as synchronous code (with all possible blocking risks)? and how...If you want me to post that separately, please let me know.
Your help is greatly appreciated. Thanks
I am trying to call a stored procedure in SQL server database, and the stored procedure returns more than one table
Like
select * from table1
select * from table2
select * from table...n
When the resultset returns It looks like having only the first table in the Crsr object.
What should I do if I have more than one table (E.g. Passenger, and His list of payments).
I had to split what I want into 2 different calls each returns one table / query... but I feel it is not efficient. Here is my example Code (It is just trials and not having complete meaning).
Also I have another question that could be related: Is there a way to do the calls to the database as synchronous code (with all possible blocking risks)? and how...If you want me to post that separately, please let me know.
Your help is greatly appreciated. Thanks
B4X:
Sub Connect As ResumableSub
RemoteSQL.InitializeAsync("RemoteSQL", driver, jdbcUrl, Username, Password)
Wait For RemoteSQL_Ready (Success As Boolean)
If Success = False Then
Log("Check unfiltered logs for JDBC errors.")
End If
Return Success
End Sub
Sub CloseConnection
RemoteSQL.Close
End Sub
Sub GetPassenger As ResumableSub
Wait For (Connect) Complete (Success As Boolean)
If Success Then
Try
Dim sf As Object = RemoteSQL.ExecQueryAsync("RemoteSQL", "exec up_read_passenger ?", Array(19567))
Wait For (sf) RemoteSQL_QueryComplete (Success As Boolean, Crsr As JdbcResultSet)
If Success Then
Do While Crsr.NextRow
lblWelcome.text=Crsr.GetString("last_name") & ", " & Crsr.GetString("first_name")
Loop
Crsr.Close
sf=RemoteSQL.ExecQueryAsync("RemoteSQL", "exec up_read_package ?", Array(134))
Wait For (sf) RemoteSQL_QueryComplete (Success As Boolean, Crsr As JdbcResultSet)
Do While Crsr.NextRow
txtPackage.text=Crsr.GetString("package_name")
Loop
Crsr.Close
End If
Catch
Success = False
Log(LastException)
End Try
CloseConnection
End If
Return Success
End Sub