Android Question Problem with REAL at sqlite

iNKUBO

Member
Hi:

I've a database with a table- This table have 3 fields, two of them are TEXT, and the other one is REAL
I'm trying to display the REAL value, but can not get it

B4X:
Sub CStr(val) As String
    Return val
End Sub

Sub leer_registros
    Dim rs As ResultSet
    Dim where As String
    where="%" & SpinnerMEs.SelectedItem & "%" & SpinnerAno.SelectedItem &"%"

    'Lineas de Totales

    rs=sql.ExecQuery2("select * from dias where dia like ? order by dia asc",Array As String(where))
    Dim i As Int
    Totales.Clear
    For i=0 To rs.RowCount-1
        Dim h As String
        
        Log(rs.GetDouble("Horas"))
        h=CStr(rs.GetDouble("Horas"))

        rs.Position=i
        Totales.Add(crea_row(rs.GetString("Dia"),h,rs.GetString("Tipo")),rs)

    Next
end sub

I can not read REAL data form sqllite...I get this error

1638378989223.png


Everything works fine if i use a INTEGER instead of REAL and use rs.GetInt ...but the data must be REAL or FLOAT ( i need decimals )

Don't understand where the problem is with GetDouble function ... any help ?

Thank you very much in advance.
 

iNKUBO

Member
1. Please post code and logs as text.
2. Correct code:
B4X:
Do While rs.NextRow


Loop
Thank you so much for your answer Mr. @Erel ...and thank you very much for all your work!

Finally i realized that i was trying to get a value from the resultset, but rs.position was not initialized first.
 
Upvote 0
Top