3
Answers

getting data between two dates

Dear all,
i have one Repository class(Repository.cs) with some methods for getting the data, methods are
1) 
  1. public async Task<List<T>> Get()  
  2.       {  
  3.           return await _db.Table<T>().ToListAsync();  
  4.       }  
2)
  1. public async Task<T> Get(Expression<Func<T, bool>> predicate)  
  2.        {  
  3.            return await _db.FindAsync<T>(predicate);  
  4.        }  
3) 
  1. public async Task<T> Get(int id)  
  2.       {  
  3.           return await _db.FindAsync<T>(id);  
  4.       }  
i have one table Expense..
  1. public class Expence : EntityClass  
  2.    {  
  3.        public string Date { getset; }  
  4.        public decimal Amount { getset; }  
  5.        public string Purpose_Of_Spending { getset; }  
  6.        public string Type { getset; }  
  7.    }  
Now i want to get data between two dates from Expense table, how can i do that please help, Here i'm using SQLite database with AsyncSqliteConnection
i have tried like that
 
  1. public async void queryvals()  
  2.         {  
  3.             Repository<Expence> repo = new Repository<Expence>();  
  4.             SQLiteAsyncConnection con = DatabaseAccess.GetConnection();  
  5.   
  6.             var DateData = con.QueryAsync<Expence>("SELECT * FROM Expence WHERE Date between '" + FrmDate.Text + "' AND '" + ToDate.Text + "'");  
  7.             var DatesData2 = await repo.Get(x => (x.Date == ToDate.Text) && (x.Date == FrmDate.Text));  
  8.         }  
 but i'm not getting the data, how should i do that can anyone suggest me.Thank you
 
Answers (3)