Android Question [Solved] jRDC2 problem with date parameter

Alex.Gi

Member
Licensed User
Hello guys,
I have a Firebird DB on my server, all runs OK, all querys run OK,
but I have a little problem when I try to set a string parameter tha contains a date.
This is the error message:


Error 500 org.firebirdsql.jdbc.field.TypeConversionException: Error converting to object.

in config.properties (on server side):
B4X:
sql.menu_data_select=SELECT DISTINCT(plan_corsi.data) As data1 FROM plan_corsi, attivita WHERE plan_corsi.data >= ? AND attivita.cod_club = ? AND plan_corsi.cod_attivita = attivita.id_attivita ORDER BY plan_corsi.data

and this is the code:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    data_server = "2023-02-16 00:00:00"
    cod_club = "001"

    ExecQuery("menu_data_select", Array(data_server, cod_club))
End Sub


'-----------------------------------------------------------------------------------------------------------
' this query should be returns a series of records with a single field (DATA1) starting from the one passed as a parameter
'-----------------------------------------------------------------------------------------------------------
Sub ExecQuery(sql_cmd As String, value As Object)

    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand(sql_cmd, Array(value))

    Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
    If j.Success Then
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result(res As DBResult)
        For Each row() As Object In res2.rows
            s = row(res2.Columns.Get("DATA1"))
            s = NumberFormat2(DateTime.GetDayOfMonth(s), 2, 0, 0, False)&"-"&NumberFormat2(DateTime.GetMonth(s), 2, 0, 0, False)&"-"&NumberFormat2(DateTime.GetYear(s), 4, 0, 0, False)
           
            ...
            ...
            ...
            ...
            ...
        Next

        Log(sql_cmd&": OK")
    Else
        'Log(sql_cmd&" ERROR: " & j.ErrorMessage)

    End If
    j.Release
   
End Sub

Same error message if I set an object array:

B4X:
Dim a() As String
a = Array As String (data_server, cod_club)
Dim par As List = a

ExecQuery("menu_data_select", par)

what am I doing wrong?
 
Last edited:
Top