我正在尝试使用 SQLite 为 Windows 8 转换一些旧代码。下面是上一个会话的有效代码。
using (SqliteConnection conn = new SqliteConnection("Version=3,uri=file://flashcards0904.db"))
{
conn.Open();
using (SqliteCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "SELECT * FROM Decks where DeckGroup='" + Global.currentDeckGroup.ToString() + Global.currentDeck.ToString() + "'" + "order by random()";
List<string> myCollection = new List<string>();
using (SqliteDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
myCollection.Add(reader.GetString(0) + "~" + reader.GetString(1) + "~" + reader.GetString(2));
Global.words = myCollection.ToArray();
}
}
conn.Close();
Community.CsharpSqlite.FileStream.HandleTracker.Clear();
}
}
现在,我无法访问 SqliteDataReader 并且我正在尝试使用 List<> 函数,但我无法让“Where”子句起作用。任何帮助,这是我当前的代码:
var root = Windows.Storage.ApplicationData.Current.LocalFolderPath;
var dbPath= Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolderPath,"flashcards0904.db");
using( var db= new SQLite.SQLiteConnection(dbPath))
{
// Here is location for the missing Where Clause"
var list= db.Table<Decks>.Where??????? .ToList();
}
希望这能解释问题。
谢谢