Android Question How to use JdbcResultSet?

gacar

Active Member
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

Code:
     Dim rs As JdbcResultSet =  SQL.execquery("select * FROM Bolge")
     Do While rs.nextrow
        LabelIstanbul.Text = rs.getstring2(2)
     Loop
    rs.Close
 
Solution
Code:
 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.
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.
You are 100% correct. This is why I added: "Better solution is to add a WHERE clause and get the relevant value."
 
Upvote 0
Back
Top