Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 799
Scott Nimrod Avatar asked Jun 21 '26 12:06

Scott Nimrod


1 Answers

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

var platform = new SQLitePlatformAndroid();
var connection = new SQLiteConnection(platform, path);
like image 55
Iván Oliver Avatar answered Jun 23 '26 14:06

Iván Oliver



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!