1

I am using SQLite.Net-PCL (trying to) in my WPF application.

I am stuck trying to make a connection.

I have this:

var connector = new SQLiteConnection(S, "My_DB_Path");

where 'S' is of type:

SQLite.Net.Interop.ISQLitePlatform 

But how do I make this setting - confused...

Andrew Simpson
  • 6,883
  • 11
  • 79
  • 179

3 Answers3

1

Googling around, it seems that the SQLiteConnection class has a constructor that just accepts a string. Can you use that one instead?

Something like:

new SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;")
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
0

You can use the SQLiteConnection as follows

string dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "db_Name.db");

        db = new SQLiteConnection(dbPath);

        if (db != null)
            db.CreateTable<Table_Name>();
Nishanth Bhat
  • 56
  • 1
  • 7
0

In Android, I'm using new SQLiteConnection(new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(), path);

For WPF maybe you can use a generec platform. See this topic

Community
  • 1
  • 1
Luiz
  • 198
  • 2
  • 13