0
I am using Sqlite and Nhibernate, and I am saving in my bank the Datas
as String
in Sqlite, as it is not possible to store dates in it. Everything was going ok, but I needed to compare dates to print out a report. Now, I can’t make that comparison, because it’s in string
, and I can’t convert to Date
in LINQ/Lambda.
I 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 of the one Exception
in the first Where
:
"The 'c' variable of the'Locations' type is referenced in the 'scope, but not defined".
I don’t know if that’s the problem, but I’d really like how I can compare two dates on Nhibernate, being that they’re on string
because recorded in Sqlite.