我知道这个话题已经结束了,但我束手无策。
我需要解析一个csv。这是一个相当普通的 CSV,解析逻辑是由另一位开发人员使用 OleDB 编写的,他在度假前发誓它可以工作:)
CSV sample:
Dispatch Date,Master Tape,Master Time Code,Material ID,Channel,Title,Version,Duration,Language,Producer,Edit Date,Packaging,1 st TX,Last TX,Usage,S&P Rating,Comments,Replace,Event TX Date,Alternate Title
,a,b,c,d,e,f,g,h,,i,,j,k,,l,m,,n,
我遇到的问题是,根据我尝试的连接字符串,我会遇到各种错误。
当我尝试连接字符串时:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source="D:\TEST.csv\";Extended Properties="text;HDR=No;FMT=Delimited"
我得到错误:
'D:\TEST.csv' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
当我尝试连接字符串时:
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\TEST.csv;Extended Properties=Excel 12.0;
或连接字符串
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\TEST.csv;Extended Properties=Excel 8.0;
我得到错误:
External table is not in the expected format.
我正在考虑丢弃所有代码并从头开始。有什么明显的我做错了吗?