2
votes

I working with a Windows Phone 8 application using

C#/XAML SQLite v3.7.15 sqlite-net 1.0.7' & Peter Huene's sqlite-net-wp8 (https://github.com/peterhuene/sqlite-net-wp8)

When debugging from VS I'm able to create a table, add data to the table and display the data in the UI. However, stop debugging and then resume the data from the last session is gone.

I create the connection like this

Connection = new SQLiteAsyncConnection("taskDB.db");

I'm not sure where that is putting the database?

I have tried the below so I could be sure where the database was being put but it results in the below error. I am surprised by this as I have seen this statement used in multiple examples.

_dbPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "taskDB.db");
Connection = new SQLiteAsyncConnection(_dbPath);

Which results in this error within SQLite.cs itself:

Error Message

SQLite.SQLiteException was unhandled by user code
HResult=-2146233088
Message=no such table: Tasks
Source=JustSQLite

Any idea why the database is not persisted between debug sessions?

1

1 Answers

1
votes

The Emulator instance persists the changes till it is running. Once you close the Emulator, the file will no longer persist as it is dependent on the Emulator instance