accessing CSV files through C# and ADO.NET

  • Thread starter Thread starter Paulos
  • Start date Start date
P

Paulos

Hi

Has anyone any experience of accessing .CSV files with ADO.NET and C#?

All I want to do is open and read a number of them.

I have search the help files, the MDSN and all the books I have but so far,
I have found no mention of how to do this.

Any help/sample code would be appreciated

Tnx

Paul BJ
 
Hi

Has anyone any experience of accessing .CSV files with ADO.NET and C#?

All I want to do is open and read a number of them.

I have search the help files, the MDSN and all the books I have but so far,
I have found no mention of how to do this.

Any help/sample code would be appreciated

Tnx

Paul BJ

I have no experience actually doing this - so I can't attest to the quality
of the library... But, you might want to check the SharpCvsLib over at
http://www.icsharpcode.net.
 
Paulos said:
Has anyone any experience of accessing .CSV files with ADO.NET and C#?

All I want to do is open and read a number of them.

I have search the help files, the MDSN and all the books I have but so far,
I have found no mention of how to do this.

Any help/sample code would be appreciated

You could use the ODBC Driver for Text:
http://www.able-consulting.com/MDAC/ADO/Connection/ODBC_DSNLess.htm#ODBCDriverForText

or you can also open a Text file using the JET OLE DB Provider:
http://www.able-consulting.com/MDAC...roviders.htm#OLEDBProviderForMicrosoftJetText

Cheers

Arne Janning
 
Sorry I should have been more specific....

What I need to do is to open the CSV files (comma delimited text files) as
what used to be called recordsets in ADO. I then need to manipulate the data
and insert the it into a SQL Server DB.
 
You might want to search the Gotdotnet.com user samples area for Chris
Lovett's XMLCSVREADER implementation.
This will allow you to read and convert a CSV text file into an XmlDocument,
and this can then be easily loaded into a DataSet using the ReadXml method.
--Peter
 
Back
Top