Failed to open the database file. Application for Windows Store 8.1.

I am trying to implement a database in my Windows 8.1 Modern UI application. I did this for the Windows Phone 8.1 application successfully, but it does not work in the new Windows 8.1 application.

I received SQLiteExceptionwith a message Could not open database file: MyAppBase.db (CannotOpen)when I installSQLiteConnection

public static DatabaseHelper Instance
    {
        get
        {
            if (_instance == null)
            {
                _instance = new DatabaseHelper();
            }

            return _instance;
        }
    }

    public DatabaseHelper()
    {
        _connection = new SQLiteConnection(DATABASE_NAME);

        _connection.CreateTable<UserEntity>();
    }

I perform the following actions: Added “sqlite-net” link to Nuget link, checked “SQLite for Windows Runtime (Windows 8.1)” and “Microsoft Visual C ++ 2013 Runtime Package for Windows” in project links, Targetted build to x86.

How can I make this work?

+4
source share
2 answers

SQLite , db

-

string path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, DATABASE_NAME);

_connection = new SQLite.SQLiteConnection(path)

,

+8

string path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, databasePath);
0

All Articles