Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Sqlite.SqliteException Could not open database file filepath (CannotOpen) in Xamarin.Forms

$
0
0

I am working on a Xamarin.Forms application and using SQlite for my database.

Currently I have created a new database using the DB Browser for SQLite.

In my code behind, when my application initially runs, I try to connect to SQLiteAsyncConnection and give the path to the local folder (on the PC) where I created the new database via sqlite browser. This step always throws the error "Could not open database file".

Following lines I have tried but it all throws error:

`string path = "C:\Users\hp\Data\CheckList.db";
SqlConnection = new SQLiteAsyncConnection(path);

string path = @C:\Users\hp\Data\CheckList.db;
SqlConnection = new SQLiteAsyncConnection(path);

string path = "C://Users//hp//Data//CheckList.db";
SqlConnection = new SQLiteAsyncConnection(path);`

All the above lines fail for me.

Also attaching screenshot for reference.

Any help or suggestions would be great!!!..


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>