我正在 Windows 商店应用程序中处理 SQLite。我正在使用更新表中的值
var tagPage = db.QueryAsync<MyModel>("UPDATE MyModel SET Tag =2 WHERE id = 1");
db.UpdateAsync(tagPage);
Run Code Online (Sandbox Code Playgroud)
它通过该方法在 SQLite.cs 类上抛出 NotSupportedException
public int Update(object obj, Type objType)
{
if (obj == null || objType == null)
{
return 0;
}
var map = GetMapping(objType);
var pk = map.PK;
if (pk == null)
{
throw new NotSupportedException("Cannot update " + map.TableName + ": it has no PK");
}
var cols = from p in map.Columns
where p != pk
select p; …Run Code Online (Sandbox Code Playgroud)