No such table sqlite on xamarin forms pcl

I have a problem with the reading of the tables on the SQLite database.

my interface in pcl project:

public interface IDatabaseConnection
{
SQLite.SQLiteConnection DbConnection();
}
Android

[assembly: Xamarin.Forms.Dependency(typeof(DatabaseConnection_Android))]
namespace Fimap.Droid
{
public class DatabaseConnection_Android : IDatabaseConnection
{
public SQLiteConnection DbConnection()
{
var dbName = "FimapDB.db3";
var path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), dbName);
return new SQLiteConnection(path);
}
}
}
iOS

[assembly: Xamarin.Forms.Dependency(typeof(DatabaseConnection_iOS))]
namespace App.iOS
{
public class DatabaseConnection_iOS : IDatabaseConnection
{
public SQLiteConnection DbConnection()
{
var dbName = "FimapDB.db3";
string personalFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string libraryFolder = Path.Combine(personalFolder);
var path = Path.Combine(libraryFolder, dbName);
return new SQLiteConnection(path);
}
}
}
pcl connection (database is right connect):

database = DependencyService.Get().DbConnection();

query:

var test = database.Query("SELECT * FROM OBJ_User");

when i launch the query i have this error:
SQLite.SQLiteException: no such table: OBJ_User

OBJ_User is in the dabatase with one record. Why the connection don't mapping the table ? database variable is right connect to database sqlite, i don't understand because database don't get mapping from sqlite file. Solution ?

if you want other info write me in the comment, i will answer

Posts

Sign In or Register to comment.