btnNx always stepped thru the db from first row to total row count (rs2), and continued to cycle.
After testing lots of ways I'm still unable to repeatedly count from total row count (rs2), down to 1.
What needs to be done for btnPrev_Click to countdown properly in B4I?
Thanks in advance.
B4X:
' Works on it's own
Sub btnNx_Click
rs2=sql1.ExecQuerySingleResult("Select COUNT(RowID) FROM table1")
If RowID >= rs2 Then
RowID = 0
ReadBlobNx ' The 2 ReadBlob subs differ only at (RowID + 1) for ReadBlobNx, and (RowID - 1) for ReadBlobPrevious
Log(" ")
Else
ReadBlobNx
Log(" ")
End If
RowID = RowID + 1
Log("btnNx current Row = " & RowID)
End Sub
After testing lots of ways I'm still unable to repeatedly count from total row count (rs2), down to 1.
B4X:
' cycles between 1 and 3
Sub btnPrev_Click
rs2=sql1.ExecQuerySingleResult("Select COUNT(RowID) FROM table1")
' If RowID <= 0 Then ' crashes going from 1 to rs2(total row count)
If RowID <= 1 Then ' goes from 1 to 3, skips rs2(total row count)
RowID = rs2
ReadBlobPrevious ' The 2 ReadBlob subs differ only at (RowID + 1) for ReadBlobNx, and (RowID - 1) for ReadBlobPrevious
Log(" ")
Else
ReadBlobPrevious
Log(" ")
End If
RowID = RowID - 1
Log("btnPre current Row = " & RowID)
End Sub
Thanks in advance.