views:

1354

answers:

3

Hi,

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 one (ODBC):

"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?

A: 

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.

Matt
+1  A: 

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.

Jay Riggs
I don't *need* a driver, but it would be close to zero effort to install a driver and change the connection string, and slightly > 0 effort to do something else.Looks like I'll have to do something else though :)
alexis.kennedy
+1  A: 

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

Jeremy
Not a perfect solution but a good one. Thanks Jeremy.
alexis.kennedy