CSV文件 [英] CSV files

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

问题描述

我不明白为什么图书馆里没有课程可以读取CSV文件......我已经创建了自己的CSV阅读器类,它读取了一个CSV

文件,生成一个报告并返回记录等。虽然我很自豪

解决了问题并生成了有效的代码我担心我可以

已经节省了很多时间,如果我能够在

库中找到我确信必须工作的课程。


任何人都有解释为什么没有这样的课程?



I don''t understand why there''s no class included in the libraries for
reading CSV files.. I''ve created my own CSV reader class which reads a CSV
file, generates a report and returns records etc. Although I''m proud of
having tackled the problem and produced code that works I worry that I could
have saved a lot of time if I could have just found that class in the
library which I''m convinced must work.

Does anyone have an explanation as to why there''s no such class?

Cat

推荐答案

Cat写道:
有没有人解释为什么没有这样的课?
Does anyone have an explanation as to why there''s no such class?




也许是因为格式不是/那个/经常使用,它很简单,所以30行代码足以解析它吗?


-

康拉德 -
http://madrat.net/


Cat,

您可以使用System.Data.OleDb命名空间中的类。基本上,

你将不得不使用OLEDB的提供商(我相信有一个用于逗号

分隔文本或一般的任何分隔文本)这将做你做的事情

想要。使用该提供程序,您可以像查询任何其他

数据一样查询数据,并在DataReader或DataSet中获取结果。


希望这有助于。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Cat" <螺*********** @ yahoo.co.uk>在消息中写道

新闻:eC ************** @ tk2msftngp13.phx.gbl ...
Cat,

You can use the classes in the System.Data.OleDb namespace. Basically,
you will have to use a provider for OLEDB (I believe there is one for comma
delimited text, or any delimited text in general) which will do what you
want. Using that provider, you can query the data like you would any other
data and get the results in a DataReader, or a DataSet.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Cat" <lo***********@yahoo.co.uk> wrote in message
news:eC**************@tk2msftngp13.phx.gbl...
我不是理解为什么库中没有包含用于读取CSV文件的类...我已经创建了自己的CSV阅读器类,它读取CSV文件,生成报告并返回记录等。虽然我很自豪能够解决这个问题并生成有效的代码,但我担心如果我能在
库中找到该类,我可以节省大量时间我确信必须工作。

有没有人解释为什么没有这样的课?


I don''t understand why there''s no class included in the libraries for
reading CSV files.. I''ve created my own CSV reader class which reads a CSV
file, generates a report and returns records etc. Although I''m proud of
having tackled the problem and produced code that works I worry that I could have saved a lot of time if I could have just found that class in the
library which I''m convinced must work.

Does anyone have an explanation as to why there''s no such class?

Cat



我不会说代码相当简单,因为有很多错误

检查完成和决定取决于引用的位置

标记和逗号出现在csv文件中。尽管如此,我非常喜欢一般的商业节目,所以我可能会在一年左右的时间内发表非常不同的意见。


至于csv文件没有被频繁使用 - 不幸的是由于我工作的公司的性质

我会处理相当多的文件

:(


" Konrad LM Rudolph" ko ************ @ madrat.net>写在留言中

新闻:u4 ************** @ TK2MSFTNGP09.phx.gbl ...
I wouldn''t say the code is fairly simple, since there''s a lot of error
checking to be done and decisions to be made depending on where quotation
marks and commas appear in the csv file. Still, I am very much a newbie to
C# and commercial programming in general so I may have a very different
opinion in a year or so.

As for csv files not being used so often - unfortunately due to the nature
of the company I work for I''ll be dealing with files like that quite a lot
:(

"Konrad L. M. Rudolph" <ko************@madrat.net> wrote in message
news:u4**************@TK2MSFTNGP09.phx.gbl...
Cat写道:
有没有人解释为什么没有这样的课?
Does anyone have an explanation as to why there''s no such class?



也许是因为格式不是/经常使用的,而且它是相当的简单所以30行代码足以解析它?

-
Konrad -
http://madrat.net/



这篇关于CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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