通过 64 位 ADO.NET 访问 CSV?
在 32 位 .NET 应用程序中,我可以使用此 OLEDB 连接字符串通过 ADO.NET 连接到 CSV 文件:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\foo;"
或此 ODBC 连接字符串:
"Driver={{Microsoft Text Driver (*.txt; *.csv)}};Dbq=c:\foo"
但是显然没有 OLEDB Jet 驱动程序或 ODBC 文本的 64 位版本司机。
我可以逐行解析 CSV 或以 32 位模式运行应用程序,但理想情况下我只想找到一个以 64 位运行的不同驱动程序。
有任何想法吗?
In a 32-bit .NET app, I can use this OLEDB connection string to connect to a CSV file via ADO.NET:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\foo;"
or this ODBC one:
"Driver={{Microsoft Text Driver (*.txt; *.csv)}};Dbq=c:\foo"
However there apparently arent 64-bit versions of either the OLEDB Jet drivers or the ODBC text driver.
I could parse the CSV line by line or run the app in 32-bit mode, but ideally I'd just like to find a different driver that runs as 64-bit.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
它不是驱动程序,但我对 Sebastien Lorion 的 CSV 阅读器很满意。 请注意,我从未在 64 位环境中使用过它,但我不知道有任何兼容性问题。
http://www.codeproject.com/KB/database/CsvReader.aspx
It's not a driver, but I've been pleased with Sebastien Lorion's CSV reader. Note that I've never used it in a 64-bit environment, but I'm not aware of any compatibility issues.
http://www.codeproject.com/KB/database/CsvReader.aspx
亚历克西斯,
你需要司机吗? 如果您只需要逐行读取 CSV 文件,可以使用许多免费的解析器。 如果您还需要编写 CSV,请查看 FileHelpers。
Alexis,
Do you need a driver at all? If you just need to read a CSV file line by line there are a number of free parsers out there. If you need to also write out a CSV check out FileHelpers.
您很幸运 - 2010 年 12 月,Microsoft 发布了用于 CSV 和 XLSX 文件的 64 位 OLEDB 驱动程序!
有关下载链接、安装详细信息、连接字符串等,请参阅此答案 。
You're in luck-- in December 2010 Microsoft published a a 64-bit OLEDB driver for CSV and XLSX files!
See this answer for download links, install details, connection strings, etc.
我最终不得不将我的应用程序转换为 32 位,因为我遇到了同样的问题,尽管访问 Microsoft Access 数据库。 我知道这会起作用,但您可能不想要这个解决方案。 如果有人知道这个问题的答案,我也很想听听。
I ended up having to convert my application to 32-bit because I was having the same problem, although with accessing a Microsoft Access Database. I know this will work, but you may not want this solution. If anyone knows the answer to this question I woud love to hear it as well.
我遇到了同样的问题,经过多次尝试和尝试后,我遇到了同样的问题。 错误这是我发现有效的:
1。 启用临时程序
2。 在服务器上安装此文件:
http://www.microsoft.com/downloads/en/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en
3. 使用此查询格式:
4. 启用 OLE 自动化过程:
I had this exact same problem and after much trial & error this was what I found that worked:
1. Enable Adhoc procedures
2. Install this file on server:
http://www.microsoft.com/downloads/en/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en
3. Use this query format:
4. Enable OLE Automation procedures: