Hello..
I have one question, can you please help me?
i have this function which returned value is always zero, why?
can you catch problem in here?
Any help would be appreciated
Thank You.
I have one question, can you please help me?
i have this function which returned value is always zero, why?
can you catch problem in here?
B4X:
Sub ReturnMaxFromTable(TableName As String, FieldName As String) As Int
Dim TempSQL As SQL
Dim TempCur As Cursor
TempSQL.Initialize(File.DirDefaultExternal,"mydb.db",False)
TempCur = TempSQL.ExecQuery("SELECT MAX ('" & FieldName & "') AS 'MaxValue' FROM '" & TableName & "' ")'I'm querying table which is filled with Int values
Log("TempCur.RowCount = " & TempCur.RowCount) ' This is always 1
If TempCur.RowCount > 0 Then
TempCur.Position = 0
Log("TempCur.GetInt(''MaxValue'') = " & TempCur.GetInt("MaxValue")) ' but this is always 0 (zero)
Return TempCur.GetInt("MaxValue")
Else
Return 0
End If
TempCur.Close
TempSQL.Close
End Sub
Any help would be appreciated
Thank You.