Question

Currently I'm creating my database with the help of sqlite-net, sqlite-net-wp8 and SQLite for Windows Phone the following way:

public async void Create()
        {
            SQLiteAsyncConnection db = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "localdatabase.db"));
            await db.CreateTableAsync<Sample>().ContinueWith((results) =>
            {
                Debug.WriteLine("Sample table created!");
            });
        }

I followed this tutorial.

My problem is that since it creates the localdatabase.db file in the app's isolated storage, I can't interact with it, and at every build debug, the database gets erased. I'd like to save it as a file, so I can access it from the solution explorer.

How can I do that?

Was it helpful?

Solution

First of all I'd recommend switching over to this tutorial, as it was updated to reflect some changes in the SQLite libraries (for example, they're all now accessible via NuGet, no more building from source).

I'm not entirely sure why your database is being deleted and remade on each debugging, but you cannot write to installation storage (i.e. your solution) during runtime, only app storage. If you want to browse the app storage of one of your deployed applications, whether it be on an emulator or on a device, you can use a tool like WP Power Tools.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top