简体   繁体   中英

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

I am programming an app currently i want to add a new item to the local SQLLite Database:

        public async Task SaveTaskAsync(Fault item)
    {
        try
        {
            if (item.Id == null)
            {
                await FaultTable.InsertAsync(item);
            }
            else
            {
                await FaultTable.UpdateAsync(item);
            }
        }
        catch (Exception ex)
        {

        }
    }

But the Statement await FaultTable.InsertAsync(item); is ending up with following error:

"Microsoft.WindowsAzure.MobileServices.Sync.MobileServiceLocalStoreException: Failed to perform operation on local store."

Inner Exception: "SQLitePCL.SQLiteException Query execution failed with result: 'MISMATCH'."

Stacktrace of Inner Exception:

  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 indicates that the SQL statement (that is generated from the model) is trying to insert data that does not match the schema of the table stored in the database. Did you change the model recently? If so, you will need to fix the database. You can do that either under the covers (by using a SQLite editor) or by wiping out the database and then re-syncing the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM