My SQLite database contains table players
. In DB Browser the data in the table is correct, however when retrieving the data it is returning a different value.
Value in database: 76561198113034550
, value returned: 152768822
. I'm getting the value by:
qryPlayers.Close;
qryPlayers.SQL.Text := 'SELECT * FROM players';
qryPlayers.Open;
playerID := qryPlayers.FieldByName('steamid').Value; // .AsString returns the same value
Whats causing this and how can I fix it?
I just checked, what value the 4 lower bytes of 76561198113034550
have... And tadaaa, it is 152768822
! So the upper 4 bytes are simply truncated.
Declare playerID
as Int64
, not Integer
or Cardinal
since those types only have 4 bytes in memory.
And for retrieving the value from the DB use qryPlayers.FieldByName('steamid').AsLargeInt
.