In the commented-out line below, PlatypusId is red/not recognized, although it does exist in the corresponding table.
In the multi-line spanning assignment to queryResult, PlatypusId, where, and count are red/unrecognized.
//var queryResult = await conn.Table<PlatypiRequested>().CountAsync().(x => x.PlatypusId.Equals(personId));
var queryResult = from p in PlatypiRequested
where p.PlatypusId.Equals(platypusId)
select count;
IOW, when I add this:
var conn = new SQLiteAsyncConnection(SQLitePath);
var queryResult = await conn.Table<PlatypiRequested>().CountAsync().(x => x.
...nothing is proffered as a possibility following that "x => x."
What sort of code is necessary to query my SQLite table?
I am using the SQLite-net package/extension, but its documentation (what documentation?) is not overly verbose. Looking through both SQLite.cs and SQLiteAsync.cs, I'm none the wiser...
Okay, Mr. Harvey's answer comment led me to this working code (Count() was not available, just CountAsync()):
public async Task<bool> PlatypusAlreadyAdded(string platypusId)
{
var conn = new SQLiteAsyncConnection(SQLitePath);
var queryResult = await conn.Table<PlatypiRequested>().Where(x => x.PlatypusId == platypusId).CountAsync();
return queryResult > 0;
}
As Jackie DeShannon (no relation to me, AFAIK) sang, "What the world needs now is a "SQLite/SQLite-net for C# Windows Store apps"" book (or at least a lengthy/informative blog post, containing examples of all the common types of SQL statements (CRUD)).
I think what you're really looking for is something like
var queryResult = await conn.Table<PeopleRequested>()
.Where(x => x.someField == someValue)
.CountAsync();
Your way is not going to work, since the last .
operator is expecting a method call, not an opening parenthesis or lambda expression.