wimpie3 Well-Known Member Licensed User Longtime User Oct 25, 2025 #1 Is this a valid command to know if an SQL resultset is empty? B4X: Copy If Not(ResultSet1.NextRow) then ... As far as I know, nextrow moves to the next record, so my guess is that this if statement doesn't work as intended and that I might need to use an sql rowcount statement first.
Is this a valid command to know if an SQL resultset is empty? B4X: Copy If Not(ResultSet1.NextRow) then ... As far as I know, nextrow moves to the next record, so my guess is that this if statement doesn't work as intended and that I might need to use an sql rowcount statement first.
DonManfred Expert Licensed User Longtime User Oct 25, 2025 #2 - If you haven´t used it before it moves to the first row. B4X: Copy If ResultSet1.NextRow then ' work with the data should work. - Resultset1 may be not initialized if it contains no data Upvote 1
- If you haven´t used it before it moves to the first row. B4X: Copy If ResultSet1.NextRow then ' work with the data should work. - Resultset1 may be not initialized if it contains no data
wimpie3 Well-Known Member Licensed User Longtime User Oct 26, 2025 #3 I don't get it. Checking if Resultset1 contains no data is exactly what I'm trying to do... But using isInitialised doesn't work either. Upvote 0
I don't get it. Checking if Resultset1 contains no data is exactly what I'm trying to do... But using isInitialised doesn't work either.
LucaMs Expert Licensed User Longtime User Oct 27, 2025 #4 B4X: Copy Public Sub IsResultSetEmpty(RS As ResultSet) As Boolean Dim Empty As Boolean = True Do While RS.NextRow Empty = False Exit Loop Return Empty End Sub It should be called as soon as a query is executed. (When accessing DB it would be better to also use a Try-Catch) Last edited: Oct 27, 2025 Upvote 0
B4X: Copy Public Sub IsResultSetEmpty(RS As ResultSet) As Boolean Dim Empty As Boolean = True Do While RS.NextRow Empty = False Exit Loop Return Empty End Sub It should be called as soon as a query is executed. (When accessing DB it would be better to also use a Try-Catch)