1
下面的代码表明该错误的LINQ到Excel - 对象必须实现IConvertible错误
对象必须实现IConvertible
当我加入where子句中的LINQ表达比较DateTime
领域。
我试图使用Convert.ToDateTime(c.ETC) >= startday
但仍然是相同的错误。
var excel = new ExcelQueryFactory(excelfilename);
excel.AddMapping<BulkMovementItem>(x => x.ETC, "ETC");
var newrailtruckmovements = (from c in excel.Worksheet<BulkMovementItem>(sheetname)
where c.ETC > new DateTime(2015, 7, 1)
select c);
的BulkMovementItem
定义:
public class BulkMovementItem
{
public string ScheduleName { get; set; }
public string DealHeaderName { get; set; }
public string DealDetailName { get; set; }
public string ETC { get; set; }
public string RailcarName { get; set; }
public string Location { get; set; }
public string OriginLocation { get; set; }
public string FunctionType { get; set; }
public string ProductName { get; set; }
public string Volume { get; set; }
public string SupplierUniqueNbr { get; set; }
// Error Description
public string Status { get; set; }
public bool HasErrors { get; set; }
//public List<string> ErrorDetails { get; set; }
}
什么是'ETC'的类型? –
发布BulkMovementItem定义会有所帮助。 – Jacob
我想这是[LinqToExcel](https://github.com/paulyoder/LinqToExcel)库?如果你在你的问题中包含这些信息会很有帮助。 –