I am trying to build an Android Xamarin Application. I have created an SQLite database named regjistri.sqlite . The database it's not corrupted, I can open it via SQLite browser on my PC. This database I have save it to my android Documents folder. I am trying to access it like below via sqlite-net-pcl library.
string dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "regjistri.sqlite");
var db = new SQLiteConnection(dbPath);
var data = db.Query<object>("SELECT COUNT(*) FROM tblLidhja ");
Also I have gice the application the reading and writing permissions. When I debug it via USB cable, it give me the "SQLite.SQLiteException: no such table: tblLidhja" exception. Can someone help me whats may be wrong, or what should I change to read some data?
tblLidhja
class code and where is theTableCreate
call in your code? – SushiHangoverdb.CreateTable<tblLidhja>()
after the connection to DB is opened and before querying any data from it (that's what the exception is telling you - there is no such table in your DB). You can find an example at sqlite-net repo page: github.com/praeclarum/sqlite-net – Vitalii Ilchenko