This way only return last value in the table. How can i get only single value from a database table eg 5.row 3.column value or selected row 3.column value. Thanks
B4X:
Dim rs As JdbcResultSet = SQL.execquery("select * FROM Bolge")
Do While rs.nextrow
LabelIstanbul.Text = rs.getstring2(2)
Loop
rs.Close
Dim rs As JdbcResultSet = SQL.execquery("select * FROM Bolge")
Dim rowIndex As Int
Do While rs.nextrow
If rowIndex = 4 Then LabelIstanbul.Text = rs.getstring2(2)
rowIndex = rowIndex + 1
Loop
rs.Close
Better solution is to add a WHERE clause and get the relevant value.
Dim rs As JdbcResultSet = SQL.execquery("select * FROM Bolge")
Dim rowIndex As Int
Do While rs.nextrow
If rowIndex = 4 Then LabelIstanbul.Text = rs.getstring2(2)
rowIndex = rowIndex + 1
Loop
rs.Close
Better solution is to add a WHERE clause and get the relevant value.
Dim rs As JdbcResultSet = SQL.execquery("select * FROM Bolge LIMIT 1 OFFSET 4") '5th row
If rs.nextrow then
LabelIstanbul.Text = rs.getstring2(2)
End If
rs.Close
To understand this better, doesn't the code in post #2 also rely on intrinsic order since no order by was provided and can cause the same issue as post #3.
To understand this better, doesn't the code in post #2 also rely on intrinsic order since no order by was provided and can cause the same issue as post #3.