mardi 6 octobre 2015

Windows Phone sqlite select all

I have a query which simply does, in a table named "CUSTOMER" a select all.

This is my Table:

public class CUSTOMER : Extension.Shared
{
    [PrimaryKey, Indexed]
    public Guid ID { get; set; }
    [Indexed]
    public string FULL_NAME { get; set; }
    public string PHONE_NO { get; set; }
    //public string PIVA_CF { get; set; }
    public DateTime? MODIFIED_ON { get; set; }

And this is the query which gives me the problem

public List<CUSTOMER> SelectAll()
    {
        SQLiteConnection conn = new SQLiteConnection(DatabasePath());
        return conn.Query<CUSTOMER>("SELECT * FROM CUSTOMER");
    }

Every times i run this operation, the query returns an error from SQLite.cs file:

if (r != SQLite3.Result.OK) 
{
    throw SQLiteException.New (r, String.Format ("Could not open database file: {0} ({1})", DatabasePath, r));
}

If the size can be a useful, this table has nearly 50000 records. I have the same problem in a couple of tables with 100000 or 80000 records. No problems with other Tables, no problem with other queries.

I can say this because since I thought the table was badly saved, I installed again and again the table, but I noticed that from the same page i can call this query without any problem, for all tables:

public List<CUSTOMER> SelectByFilter(string Filter)
{
    SQLiteConnection conn = new SQLiteConnection(DatabasePath());
    return conn.Query<CUSTOMER>(string.Format("SELECT * FROM CUSTOMER WHERE FULL_NAME LIKE '{0}%'", Filter));
}

I don't really know where can this error came from. I don't know any size's restriction on Sqlite3. Any help will be appreciated.

Aucun commentaire:

Enregistrer un commentaire