I'm using SQLite and NHIbernate, and I'm saving my Datas
as String
in SQLite because I can not store dates on it. Everything was going ok, but I had to compare dates to print a report. Now, I can not make this comparison because it is in string
, and I can not convert to Date
in LINQ / Lambda.
I've tried the following:
var dataInicial = DateTime.Parse(_DataInicial);
var dataFinal = DateTime.Parse(_DataFinal);
return session.QueryOver<Locacoes>()
.Where(c => DateTime.Parse(c.DataInicial) >= dataInicial )
.Where(c => DateTime.Parse(c.DataFinal) <= dataFinal).List();
But a Exception
in the first Where
:
"Locale variable 'c' is referenced in scope '' but not defined".
I do not know if this is the problem, but I'd really like to compare two dates in NHibernate, since they are in string
because they are written in SQLite.