Scott Nimrod
Scott Nimrod

Reputation: 11570

SQLite exception when creating a connection

I receive an SQLite exception when creating a connection.

This worked before I installed VS2015 RTM.

Client (PCL):

 _databaseConnection = DependencyService.Get<IDatabase>().Connect();

Android project:

 public SQLiteConnection Connect()
 {
    var fileName = "my_file.db3";
    var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
    var path = Path.Combine(documentsPath, fileName);
    var connection = new SQLiteConnection(path);

    return connection;
 }

I receive an exception when executing:

 var connection = new SQLiteConnection(path);

Something went wrong in the build configuration. This is the bait assembly, which is for referencing by portable libraries, and should never end up part of the app.

NOTE:

SQLitePCL.raw_basic is on 0.7.1 I get errors whenever I attempt to upgrade the version to 0.8.1

Again, this all worked before I installed VS2015 RTM Any suggestions?

Upvotes: 3

Views: 868

Answers (1)

Iv&#225;n Oliver
Iv&#225;n Oliver

Reputation: 126

You need to initialize a new connection and you will need an ISQLitePlatform implementation.

var platform = new SQLitePlatformAndroid();
var connection = new SQLiteConnection(platform, path);

Upvotes: 2

Related Questions