Sub Button1_Click
Private Q As String
Private Cur As Cursor
Q = "select id,nm,cst_prc,sls_prc from m_gd where nm = 'COKE'"
Cur = SqlLt.ExecQuery(Q)
For i = 0 To Cur.RowCount - 1
Cur.Position = i
Msgbox("ID : " & Cur.GetInt2(0),"")
Msgbox("NAME : " & Cur.GetString2(1),"")
Msgbox("COST : " & Cur.GetInt("CST_PRC"),"")
Msgbox("SLS PRC : " & Cur.GetInt2(3),"")
Next
Cur.Close
Tbl1.LoadSQLiteDB(SqlLt, Q, True)
End Sub
Cursor and table gave different result.
Attached is a sample project, could this is a bug? Using B4A ver 3.8
SQLite does not enforce data type. You can have an INTEGER data type and still save a string in it. The fact that you stored 2,500 in an INTEGER field, SQLite regarded it as a string and returned 2 since the integer of 2,500 is 2.
SQLITE uses 4 data types: TEXT, INTEGER, BLOB, REAL. But, you cans store anything in any of them.
Actually, the value in the field inputted as 2500, without any comma. But in the display, it is formatted to 2,500 and then saved to SQLite without reformatted again to 2500.
Never thought that SQLite would accepted this value.
You said that SQLite not enforced data type, so which one is better to store the value in field, 2500 or 2,500? The value will be used for calc, such as get total, etc.
It is much better to store 2500 without the comma. That way you will have no trouble doing the math. You data type could then be INTEGER or TEXT and you can still do the math even if stored as TEXT.