簡體   English   中英

Azure脫機同步。 無法添加項目“查詢執行失敗,結果:'MISMATCH'。”

[英]Azure Offline Sync. Can't add item “Query execution failed with result: 'MISMATCH'.”

我目前正在編程一個應用程序,我想向本地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'。”

內部異常的Stacktrace:

  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編輯器),也可以清除數據庫,然后重新同步數據。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM