vendredi 3 juillet 2015

Using SQLite.Net.Async.SQLiteAsyncConnection Questions

Could someone advise whether the code I have here is right or not? I am using the async version of SQLite.Net.Async-PCL library.

using SQLite.Net;using SQLite.Net.Async;using SQLite.Net.Attributes;
string databasePath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "Scheduler.sqlite");
    public static SQLiteAsyncConnection db;
 var conFunction = new Func<SQLiteConnectionWithLock>(() =>
            new SQLiteConnectionWithLock(new SQLitePlatformWinRT(),
                new SQLiteConnectionString(databasePath, false)));
        var connectionString = new SQLiteConnectionString(databasePath, false);
        var connectionWithLock = new SQLiteConnectionWithLock(new SQLitePlatformWinRT(), connectionString);
        db = new SQLiteAsyncConnection(() => connectionWithLock);

This code doesn't show any red squiggly's, but it doesn't work at all.

var existing = await App.db.QueryAsync<Schedule>("select * from Schedule where Date = ? order by ShiftStart", theWeek.AddDays(i));

The above line is inside a try statement, the moment the compiler hits this line, it goes to the catch block. I am pretty there is nothing wrong with the Query Statement as I was using this with the other SQLiteAsyncConnection library. Please advise?

Aucun commentaire:

Enregistrer un commentaire