Dec 6, 2015 Replies: 3 To get the number of rows returned by a query without having to traverse the whole resultset Code: Sub rowCount(rs As JavaObject) As Int rs.RunMethodJO("last",Null) Dim count As Int = rs.RunMethod("getRow",Null) rs.RunMethod("beforeFirst",Null) Return count End Sub Use preferably before Code: do while rs.NextRow call with Code: Log(rowCount(c1)) ' c1 is the resultset Click to expand...
To get the number of rows returned by a query without having to traverse the whole resultset Code: Sub rowCount(rs As JavaObject) As Int rs.RunMethodJO("last",Null) Dim count As Int = rs.RunMethod("getRow",Null) rs.RunMethod("beforeFirst",Null) Return count End Sub Use preferably before Code: do while rs.NextRow call with Code: Log(rowCount(c1)) ' c1 is the resultset
Erel B4X founder Staff member Licensed User Longtime User Dec 6, 2015 #2 Whether it will work or not depends on the JDBC driver. Many, if not most drivers will return a forward only cursor. Such cursor cannot jump to the last or first row.
Whether it will work or not depends on the JDBC driver. Many, if not most drivers will return a forward only cursor. Such cursor cannot jump to the last or first row.
ThRuST Well-Known Member Licensed User Longtime User Dec 25, 2016 #3 You can also use SELECT Count(*) FROM TABLE Click to expand...
KMatle Expert Licensed User Longtime User Jan 23, 2017 #4 ThRuST said: You can also use Click to expand... Standard