我正在使用 ASP.NET VB.NET,CSV 文件上传和 FileHelpers,ASP.NET 控件是文件上传
读取 CSV 文件的代码
Using sr As New StreamReader(FileUpload1.PostedFile.InputStream)
Dim engine As New FileHelperEngine(GetType([MyClass]))
For Each entry As [MyClass] In engine.ReadStream(sr)
Next
End Using
文件助手
<DelimitedRecord(",")> _
<IgnoreFirst(1)> _
<IgnoreEmptyLines> _
Class [MyClass]
<FieldTrim(TrimMode.Both)> _
Public Prop1 As String
<FieldTrim(TrimMode.Both)> _
Public Prop2 As String
End Class
问题
数据中有一些逗号,因此它正在崩溃。