473,799 Members | 3,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

accessing CSV files through C# and ADO.NET

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
Nov 16 '05 #1
5 6145
On Sat, 12 Jun 2004 23:24:36 +0200, Paulos wrote:
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.

--
Tom Shelton [MVP]
Nov 16 '05 #2
SP
Look at the StreamReader class.

SP

"Paulos" <pa************ *@skynet.be> wrote in message
news:40******** **************@ news.skynet.be. ..
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

Nov 16 '05 #3
Paulos wrote:
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/...CDriverForText

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

Cheers

Arne Janning
Nov 16 '05 #4
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.
"Paulos" <pa************ *@skynet.be> wrote in message
news:40******** **************@ news.skynet.be. ..
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

Nov 16 '05 #5
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

"Paulos" <pa************ *@skynet.be> wrote in message
news:40******** **************@ news.skynet.be. ..
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.
"Paulos" <pa************ *@skynet.be> wrote in message
news:40******** **************@ news.skynet.be. ..
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


Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
16448
by: Thomas | last post by:
after spending countless hours trying, i give up and hope to get some help in here. on server1 i got the web myweb.com with my test.asp. in the test.asp, i'm trying to read a file from an UNC path with a FSO: Set myFile = Server.CreateObject("Scripting.FileSystemObject").GetFile("\\server2\myshare\myfile.txt") this fails with an Permission Denied. here's the deal:
3
4322
by: prodirect | last post by:
Hi all, I hope someone can help me. I've recently created a database and wanted to put it up on an ftp sight so that multiple people could access the same tables at the same time from different geographical locations. I have been completely unsucessful in acheiving this goal so far however. Things I have tried: Create a shortcut to ftp sight via browser then tried to map local drive to
0
2267
by: Joergen Bech | last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running application on a web server outside of my control, but only the first time I run it: 1. After a long period of inactivity (or updating the code-behind dll) accessing any aspx page in the application causes the application to run for the first time. Some of the initialization involves reading and writing some text and xml files using simple streamreader and streamwriter...
4
3783
by: Khalique | last post by:
I have built a web service whose purpose is to copy files from a secure place to client machine and vice versa. The problem I am having is perhaps related to permissions and access rights. For testing purposes, the secure place is setup on the client machine. The client (window app) calls the web service (on a different machine) and connects successfully to the web service. However, when client calls a method that copies the file from...
0
12089
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the likelihood of CRM success from less than 20 percent to 60 percent. WHITEPAPER :
3
1447
by: Gerhard | last post by:
I have an application that needs to be able to upload documents that can latter be accessed and opened by a hyperlink. I can do this easliy if I store the files in a subdirectory in the application, but we will be using multiple web servers, so the files need to be stored on a common file server. Saving them is easy enough, but how do I point a hyperlink at a file on a file server that is different from the web server? Could you please...
3
2119
by: kosmodisk | last post by:
Hi, I'm having problem accessing javascript-created elements from opened window. This occurs only when I'm including another files in opened window, javascript or css. When I comment out "<link>" and "<script>" (point (0)), the script works fine. The opening window itself (point (1)) can access the object. When page has been loaded, then I can access the object also (point (3)). The script does find included files (debug_test2.css and...
1
1610
by: leenadiwan | last post by:
Friends, Im having problem with accessing a JS file placed in another folder from a JSP popup. I tried all the following: <SCRIPT LANGUAGE="JavaScript1.1" SRC="../js/SpellCheckForm.js"></SCRIPT> <SCRIPT LANGUAGE="JavaScript1.1" SRC="/js/SpellCheckForm.js"></SCRIPT>
6
4181
by: Adam McCormack | last post by:
Good morning, I hope I'm not repeating a post, but I did try to search for the topic before asking. I am trying to resolve an issue that has come up as a result of planned migration from a single server solution to a distributed solution. A site (and interrelated batch processing scripts) has been running on a single server (IIS 6, win 2003) to two machines both are IIS 6, win 2003, the machines are as follows: box1: Webserver box2:...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10249
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10219
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6804
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5461
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.