Profile2ForStack
Profile2ForStack

Reputation: 493

How to reference SQLite database that already exists in Xamarin.Android?

I have created SQLite database and have copied it in the root of the project like that:

enter image description here

The database is called MobileSell.db It appears in Visual Studio like that:

enter image description here

My question is how can I reference it so afterwards I can say connection.InsertIntoTableArticles(value)(this is pseudo code)

Upvotes: 1

Views: 1306

Answers (1)

Robbit
Robbit

Reputation: 4358

You can refer to this.

There only three steps to achieve it:

1) Create Assets folder which is parallel with Resources folder in your project, put your .db file into it.

2) Copy the .db file to SDCard when first open the app;

3) Use SQLite.SQLiteConnection(path) to open your .db and query it.

Upvotes: 1

Related Questions