CSVHelper:GetRecords <t>抛出空日期的格式异常

时间:2016-06-16 07:09:39

标签: c# datetime csvhelper

我正在为Template类使用GetRecords函数和Entity Framework。 类中有一个可以为null的dateTime属性。

在使用GetRecords解析csv(具有&#34; null&#34;该dateTime列的数据)时,我收到格式异常:&#34;该字符串未被识别为有效的DateTime 。从索引0开始有一个未知单词。&#34;

  

堆栈跟踪:在System.DateTimeParse.Parse(String s,DateTimeFormatInfo dtfi,DateTimeStyles样式)   在System.DateTime.Parse(String s,IFormatProvider提供程序,DateTimeStyles样式)   at CsvHelper.TypeConversion.DateTimeConverter.ConvertFromString(TypeConverterOptions options,String text)   at CsvHelper.TypeConversion.NullableConverter.ConvertFromString(TypeConverterOptions options,String text)   在lambda_method(关闭)   在CsvHelper.CsvReader.CreateRecordT   System.Linq.Enumerable.ToList [TSource](IEnumerable1 source)上的System.Collections.Generic.List1..ctor(IEnumerable1集合)中的CsvHelper.CsvReader.d__631.MoveNext()   在D:\ REPOSITORY \ StandAloneApps \ trunk \ HBServiceCodeMapper中的HBServiceCodeMapper.Program.ProcessExcel(String filePath,DateTime startDate,DateTime modificationDate)

我有什么问题吗?还是空数据?

0 个答案:

没有答案