次のコードはこのエラーを示しています
オブジェクトは IConvertible を実装する必要があります
DateTime
フィールドを比較するためにLINQ式にwhere句を追加しているとき。
私は使用しようとしまし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; }
}