How to query SQLite in C# using SQL (instead of LINQ)

Answered How to query SQLite in C# using SQL (instead of LINQ)

  • Tuesday, November 27, 2012 12:18 AM
     
     

    I have been unable to find out how to perform a LINQ query with an "IN" clause; I can write the "old-fashioned" SQL easily enough, though:

                    StringBuilder sb = new StringBuilder();
                    foreach (String s in PeopleIds)
                    {
                        sb.Append(string.Format("{0,", s));
                    }
                    var sql = string.Format(
                        "Select * from Locations Where PlatypusId in ({0}) and SentTimeLocal >= EarliestToShow and SentTimeLocal <= LatestToShow Order by SentTimeLocal", sb.ToString());

    ...but have not found any examples of querying SQLite in C# using SQL. Does anybody have any samples on doing that? IOW, I need some sort of a reader to read the results that I can loop through.

    I'm using the latest version of SQLite and the SQLite-net bits (SQLite.cs and SQLiteAsync.cs)

All Replies