I'm developing a Windows Store App with sqlite as database. I'm using SQLite for Windows Runtime and sqlite-net. Trying to get a list of Guid from a table, but only getting empty guids in the list ({00000000-0000-0000-0000-000000000000}). However when querying only for one guid it works as it should be.
My code is the following:
async void SyncSurveys()
{
SQLiteConnection _db = new SQLiteConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "SurveyDB"));
var localSurveys = (from s in _db.Table<Survey>()
select s.SurveyGuid).ToList();
...
}
I've tried the query in the following format also, but it is neither works:
var localSurveys = _db.Table<Survey>().Select(s => s.SurveyGuid).ToList();
But if I'm using the following query, to get only one guid just for debug purpose it works well:
var localSurvey = db.Table<Survey>().FirstOrDefault().SurveyGuid;
In the not working scenario the list's count matches the table's rowcount. Does anyone have any idea why this isn't working with the list version?
Parsemethod, e.g._db.Table<Survey>().Select(s => Guid.Parse(s.SurveyGuid)).ToList();. Not sure what's the data type ofSurveyGuid, is it string in a database? This would usually happen when the code callsnew Guid()instead ofGuid.NewGuid()orGuid.Parse*- oleksiiSystem.Guid, the table generated with the sqlite-net, but as I know in sqlite database isn't a thing called datatype, your datatype can by anything, like ChickenSoup or whatever. Your solution won't work, becauseSurveyGuidis aGuid, butGuid.Parse()expects string. - Ferenc Balogh