so I've been trying a bit around sqlite-net-pcl and this just doesn't seem to be able to update the status... After trying around a bit with a teststring to somewhere localize the problem it starts with the first list which appears to be filled with 0's only so I've somewhat reverted it back to where it was.
public async Task UpdateStatus()
{
var ObjectIDList = await database.QueryAsync<long>("SELECT ObjectID FROM Object WHERE ObjectStatus = 0 OR ObjectStatus = 1");
if (ObjectIDList != null)
{
foreach (long ObjectID in ObjectIDList)
{
byte newStatus = 5;
var result = await database.Table<Object>().Where(i => i.ObjectID == ObjectID).FirstOrDefaultAsync();
if (result != null)
{
result.Objectstatus = newStatus;
await SaveObjectAsync(result);
}
}
}
}
No matter how many entries there are in my table, whenever there is either a 0 or a 1 in the object's status value it filled the list with another 0.
Question
Why is ObjectIDList
always returning zeros even though I have many records in the database whose ObjectStatus = 0 or ObjectStatus = 1
? If I have 5 records, then it returns 5 results but with zeros instead of the actual ObjectID
.