I'm using LinqToExcel to read the data in a book, and it works fine, now what I'm trying to do is put a clause where, to get cleaner data.
I have this
var resultado = (from row in book.Worksheet(NombreSheet)
let item = new Clases.Comprobante.Comprobante
{
//Asignaciones por aqui y por alla
}
select item).ToList();
As I said, this works well, and it brings me all the information that is on the excel sheet and makes a Proof item. The idea is to put a clause where for the data that I throw is already clean, and not clean it later.
Within that sheet, I have several columns, one of them is called ACTIVE, with a value of 1 or 0, depending on the case, what I want to try is this
var resultado = (from row in book.Worksheet(NombreSheet)
where row["ACTIVO"].Cast<string>() == "1"
let item = new Clases.Comprobante.Comprobante
{
//Asignaciones por aqui y por alla
}
select item).ToList();
That only the object creates me if the ACTIVE column of the line contains a 1.
If I try this, it gives me this exception "The data types do not match in the criteria expression." apart from an error in the debug and something from the COM ....
Any ideas?
Greetings