Azure脱机同步.可以';t添加项目“;查询执行失败,结果为:';不匹配'&”;
本文关键字:结果 失败 不匹配 执行 项目 可以 同步 脱机 添加 Azure 查询 | 更新日期: 2023-09-27 17:58:59
我正在编程一个应用程序,我想向本地SQLLite数据库添加一个新项目:
public async Task SaveTaskAsync(Fault item)
{
try
{
if (item.Id == null)
{
await FaultTable.InsertAsync(item);
}
else
{
await FaultTable.UpdateAsync(item);
}
}
catch (Exception ex)
{
}
}
但是语句await FaultTable.InsertAsync(item);
最终出现以下错误:
"Microsoft.WindowsAzure.MobileServices.Sync.MobileServiceLocalStoreException:无法对本地存储执行操作。"
内部异常:"SQLitePCL.SQLiteException查询执行失败,结果为:'MISMATCH'。"
内部异常的堆栈跟踪:
at Microsoft.WindowsAzure.MobileServices.SQLiteStore.MobileServiceSQLiteStore.ValidateResult (SQLiteResult result) [0x00023] in <filename unknown>:0
at Microsoft.WindowsAzure.MobileServices.SQLiteStore.MobileServiceSQLiteStore.ExecuteNonQuery (System.String sql, IDictionary`2 parameters) [0x00057] in <filename unknown>:0
at Microsoft.WindowsAzure.MobileServices.SQLiteStore.MobileServiceSQLiteStore.BatchInsert (System.String tableName, IEnumerable`1 items, System.Collections.Generic.List`1 columns) [0x000f5] in <filename unknown>:0
at Microsoft.WindowsAzure.MobileServices.SQLiteStore.MobileServiceSQLiteStore+<>c__DisplayClass10_0.<UpsertAsyncInternal>b__0 (System.Threading.Tasks.Task t) [0x00058] in <filename unknown>:0
at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke () [0x00027] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:63
at System.Threading.Tasks.Task.Execute () [0x00016] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:2502
MISMATCH表示SQL语句(从模型生成)试图插入与数据库中存储的表的架构不匹配的数据。你最近换型号了吗?如果是这样,则需要修复数据库。您可以在封面下(通过使用SQLite编辑器)或通过清除数据库,然后重新同步数据。