tsteward Well-Known Member Licensed User Longtime User Feb 9, 2025 #1 Probably very simple but I may have confused myself. I'm going through my app trying to make it more crash resistant. Can I / should I check there are rows to process before processing them and how? Attached is sample code. How do I detect No results. B4A and B4i please. B4X: Expand Collapse Copy Dim rsData As ResultSet = Main.sql1.ExecQuery2($"SELECT * FROM table WHERE ID = ?"$, Array As String(myID)) Do While rsData.NextRow ..... Loop rsData.close 'I want to pop up a message if there are no results'
Probably very simple but I may have confused myself. I'm going through my app trying to make it more crash resistant. Can I / should I check there are rows to process before processing them and how? Attached is sample code. How do I detect No results. B4A and B4i please. B4X: Expand Collapse Copy Dim rsData As ResultSet = Main.sql1.ExecQuery2($"SELECT * FROM table WHERE ID = ?"$, Array As String(myID)) Do While rsData.NextRow ..... Loop rsData.close 'I want to pop up a message if there are no results'
tsteward Well-Known Member Licensed User Longtime User Feb 9, 2025 #2 For know I am setting a flag to false before the do while loop and true inside the loop so I can deal with it later. Seems to work. Upvote 0
For know I am setting a flag to false before the do while loop and true inside the loop so I can deal with it later. Seems to work.
J Jerryk Active Member Licensed User Longtime User Feb 9, 2025 #3 B4X: Expand Collapse Copy If rsData.RowCount > 0 Then .... Else 'send message End if Upvote 0
tsteward Well-Known Member Licensed User Longtime User Feb 9, 2025 #4 Jerryk said: B4X: Expand Collapse Copy If rsData.RowCount > 0 Then .... Else 'send message End if Click to expand... I can't use that in B4i Upvote 0
Jerryk said: B4X: Expand Collapse Copy If rsData.RowCount > 0 Then .... Else 'send message End if Click to expand... I can't use that in B4i
MicroDrie Well-Known Member Licensed User Longtime User Feb 9, 2025 #5 You can perhaps use the sqlite count query first: Retrieve select count: Expand Collapse Copy SELECT count(TableColumn) FROM Table and test if the result is greater then zero. Upvote 0
You can perhaps use the sqlite count query first: Retrieve select count: Expand Collapse Copy SELECT count(TableColumn) FROM Table and test if the result is greater then zero.
R RB Smissaert Well-Known Member Licensed User Longtime User Feb 9, 2025 #6 tsteward said: I can't use that in B4i Click to expand... >Dim rsData As ResultSet >If rsData.RowCount > 0 Then >I can't use that in B4i Is that really so? Are you not confusing this with Cursor? I hope it is not true as I use this a lot in B4A and have plans to eventually convert to B4i. RBS Upvote 0
tsteward said: I can't use that in B4i Click to expand... >Dim rsData As ResultSet >If rsData.RowCount > 0 Then >I can't use that in B4i Is that really so? Are you not confusing this with Cursor? I hope it is not true as I use this a lot in B4A and have plans to eventually convert to B4i. RBS
aeric Expert Licensed User Longtime User Feb 9, 2025 #7 tsteward said: For know I am setting a flag to false before the do while loop and true inside the loop so I can deal with it later. Seems to work. Click to expand... Yes, that's how I do too. Upvote 0
tsteward said: For know I am setting a flag to false before the do while loop and true inside the loop so I can deal with it later. Seems to work. Click to expand... Yes, that's how I do too.