How to read a CSV file into a .NET Datatable

后端 未结 22 2422
野性不改
野性不改 2020-11-22 05:12

How can I load a CSV file into a System.Data.DataTable, creating the datatable based on the CSV file?

Does the regular ADO.net functionality allow this?

22条回答
  •  孤城傲影
    2020-11-22 05:47

    Here's an excellent class that will copy CSV data into a datatable using the structure of the data to create the DataTable:

    A portable and efficient generic parser for flat files

    It's easy to configure and easy to use. I urge you to take a look.

提交回复
热议问题