473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Importing CVS files

I'm wondering if there's any quick way to extract data from a CSV file using C# or whether I'll need to write code to read lines from the file and break down the resulting strings. No need for code examples if I have to do the latter, cheers, just looking for some quick pointers in the right direction

Cat
Nov 16 '05 #1
8 1976
Depending on what your end goal is, you can import it directly into a
dataset using the Oledb driver http://www.connectionstrings.com/ (check
under the section for 'text')
"logicalfeline" <an*******@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
I'm wondering if there's any quick way to extract data from a CSV file using C# or whether I'll need to write code to read lines from the file and
break down the resulting strings. No need for code examples if I have to do
the latter, cheers, just looking for some quick pointers in the right
direction.
Cat

Nov 16 '05 #2
Hi,

www.opennetcf.org there you will find an implementation

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"logicalfeline" <an*******@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
I'm wondering if there's any quick way to extract data from a CSV file using C# or whether I'll need to write code to read lines from the file and
break down the resulting strings. No need for code examples if I have to do
the latter, cheers, just looking for some quick pointers in the right
direction.
Cat

Nov 16 '05 #3
As far as I know, there's no built-in way in the FrameWork itself.
Regex.Split is the one I use.

--
Alex Moskalyuk
_____________________________
http://www.techinterviews.com

"logicalfeline" <an*******@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
I'm wondering if there's any quick way to extract data from a CSV file using C# or whether I'll need to write code to read lines from the file and
break down the resulting strings. No need for code examples if I have to do
the latter, cheers, just looking for some quick pointers in the right
direction.
Cat

Nov 16 '05 #4
"logicalfeline" wrote ...
I'm wondering if there's any quick way to extract data from a CSV file

using C# or whether I'll need to write code to read lines from the file and
break down the resulting strings. No need for code examples if I have to do
the latter, cheers, just looking for some quick pointers in the right
direction.

The following thread in news://microsoft.public.dotnet.framework.adonet has
some code available for it, as well as information on using SQL DTS
packages.

Subject: Importing CSV Files Into MSDE Databases
Date: Friday, March 19, 2004 6:46 PM

--
Regards,

Fred Chateau
e-mail: fchateauAtHotelMotelNowDotCom
Nov 16 '05 #5
How would I go about doing that?

"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Depending on what your end goal is, you can import it directly into a
dataset using the Oledb driver http://www.connectionstrings.com/ (check
under the section for 'text')
"logicalfeline" <an*******@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
I'm wondering if there's any quick way to extract data from a CSV file using C# or whether I'll need to write code to read lines from the file

and break down the resulting strings. No need for code examples if I have to do the latter, cheers, just looking for some quick pointers in the right
direction.

Cat


Nov 16 '05 #6
Just use the connection string I pointed you to, and now it's going to
function like any other DB connection. You could configure a dataadapter
and just call the fill method. Anyway, here's a sample doing it with excel
http://www.knowdotnet.com/articles/exceldatasource.html just change your
connection string.

HTH,
"logicalfeline" <lo***********@yahoo.co.uk> wrote in message
news:O9**************@TK2MSFTNGP12.phx.gbl...
How would I go about doing that?

"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Depending on what your end goal is, you can import it directly into a
dataset using the Oledb driver http://www.connectionstrings.com/ (check
under the section for 'text')
"logicalfeline" <an*******@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
I'm wondering if there's any quick way to extract data from a CSV file

using C# or whether I'll need to write code to read lines from the file

and
break down the resulting strings. No need for code examples if I have to

do
the latter, cheers, just looking for some quick pointers in the right
direction.

Cat



Nov 16 '05 #7
Logical,

writing the code necessary to parse the CSV file is quite trivial in C#
(I've done it in C++ and PL/SQL as well). Here is alink to an article that
I wrote that shows one approach -- (look about half way down in the article
for the ScanLine method that implements the state machine for generating the
tokes for a line)...

http://www.onecustomer.com/TechArticles/TechArt15.html

regards
roy fine
"logicalfeline" <an*******@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
I'm wondering if there's any quick way to extract data from a CSV file using C# or whether I'll need to write code to read lines from the file and
break down the resulting strings. No need for code examples if I have to do
the latter, cheers, just looking for some quick pointers in the right
direction.
Cat

Nov 16 '05 #8
you could also use the OPENROWSET function..

this SQL snippet will allow you to import the C:\Customers.csv file directly into your MSDE Databas

SELECT
INTO myImportTabl
FROM
OPENROWSET('MSDASQL'
'Driver={Microsoft Text Driver (*.txt; *.csv)};DEFAULTDIR=C:\;Extensions=CSV;'
'SELECT * FROM Customers.CSV'
Nov 16 '05 #9

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

Similar topics

2
by: Ed Leafe | last post by:
If I have a Python script in a file named "burp.zz", is there any way to import it into another script as you can with files named with the ..py extension? I looked at the imp module, but was...
2
by: spike grobstein | last post by:
I'm a total Python newbie, so bear with me here... I'm writing a program that has a user-configurable, module-based architecture. it's got a directory where modules are stored (.py files) which...
9
by: Philip Pinkerton | last post by:
When trying to connect to database via the pgAdmin3 GUI it asks for a password. I use the same passworrd as I did when I connect to the DB via command line but I get Ident error? how do I set,...
2
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
17
by: OdAwG | last post by:
Just some questions regarding tables. I am new Access Database and need a little help. I have the following data listed below 01. I have a table called tbl_Customer with the following...
28
by: kkadakia | last post by:
I get a daily excel file for a entire month which I want to transfer into Access at the end of the month. So, there are around 20-25 excel files I get by the end of the month, and I would like to...
4
by: tjuiowa | last post by:
Hi all - I have a file i am trying to import into an access database. The program I use (Blaise) exports it into a format like this (actual data is separated by quotation marks): ...
1
by: Wayne | last post by:
I am trying to import files that start the same but are sequencial. For instance ABC123, ABC124 from C:\FOLDERNAME. These are .dbf files that are created from a Foxpro program. I would like all the...
2
by: lrheeza | last post by:
Hello everyone, I am a newbie at MS Access and I need help!!! I am importing an excel file using Import functionality in MS Access, all the fields are required but there are instances in the...
4
by: alex21 | last post by:
I am writing an application where data can be gathered from many different places and graphed against other data. However the data from all the different places is coming in different formats such as...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.