如何将 CSV 文件读入 .NET 数据表 [英] How to read a CSV file into a .NET Datatable

查看:25
本文介绍了如何将 CSV 文件读入 .NET 数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将 CSV 文件加载到 System.Data.DataTable 中,基于 CSV 文件创建数据表?

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

常规的 ADO.net 功能是否允许这样做?

Does the regular ADO.net functionality allow this?

推荐答案

这里有一个优秀的类,它将使用数据的结构将 CSV 数据复制到数据表中以创建数据表:

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

一个便携式和用于平面文件的高效通用解析器

它易于配置且易于使用.我劝你看看.

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

这篇关于如何将 CSV 文件读入 .NET 数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆