473,769 Members | 7,923 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Read Tab dilimeted file

Hi,
I have a excel file, also saved as tab delimited file. Now this tab
delimited file has text(as table) for eg

date empid empsal

10/01/2007 1 20000

now i want to read this table from txt file into a dataset.
How can I do that.

Thanks
Nov 8 '07 #1
4 4678
On 2007-11-08 14:50:01 -0800, bobby <bo***@discussi ons.microsoft.c omsaid:
Hi,
I have a excel file, also saved as tab delimited file. Now this tab
delimited file has text(as table) for eg

date empid empsal

10/01/2007 1 20000

now i want to read this table from txt file into a dataset.
How can I do that.
You'll want to look at methods such as StreamReader.Re adLine(),
String.Split(), and the Parse() method (and related) on the various
types you'll want to generate (such as DateTime and Int32).

Pete

Nov 9 '07 #2
An alternate method would be to use the Microsoft Text Driver with the
OdbcConnection & OdbcDataAdapter to open the file as though it were a
database and simply fill the data set directly.

--
Andrew Faust
andrew[at]andrewfaust.com
http://www.andrewfaust.com
"Peter Duniho" <Np*********@Nn OwSlPiAnMk.comw rote in message
news:2007110816 105138165-NpOeStPeAdM@NnO wSlPiAnMkcom...
On 2007-11-08 14:50:01 -0800, bobby <bo***@discussi ons.microsoft.c om>
said:
>Hi,
I have a excel file, also saved as tab delimited file. Now this tab
delimited file has text(as table) for eg

date empid empsal

10/01/2007 1 20000

now i want to read this table from txt file into a dataset.
How can I do that.

You'll want to look at methods such as StreamReader.Re adLine(),
String.Split(), and the Parse() method (and related) on the various types
you'll want to generate (such as DateTime and Int32).

Pete
Nov 9 '07 #3
Or, one could use the Jet provider and the OleDb data providers:

http://msdn2.microsoft.com/en-us/library/ms974559.aspx
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Andrew Faust" <an****@andrewf aust.comwrote in message
news:7B******** *************** ***********@mic rosoft.com...
An alternate method would be to use the Microsoft Text Driver with the
OdbcConnection & OdbcDataAdapter to open the file as though it were a
database and simply fill the data set directly.

--
Andrew Faust
andrew[at]andrewfaust.com
http://www.andrewfaust.com
"Peter Duniho" <Np*********@Nn OwSlPiAnMk.comw rote in message
news:2007110816 105138165-NpOeStPeAdM@NnO wSlPiAnMkcom...
>On 2007-11-08 14:50:01 -0800, bobby <bo***@discussi ons.microsoft.c om>
said:
>>Hi,
I have a excel file, also saved as tab delimited file. Now this tab
delimited file has text(as table) for eg

date empid empsal

10/01/2007 1 20000

now i want to read this table from txt file into a dataset.
How can I do that.

You'll want to look at methods such as StreamReader.Re adLine(),
String.Split() , and the Parse() method (and related) on the various types
you'll want to generate (such as DateTime and Int32).

Pete
Nov 10 '07 #4
The following can be used to read csv/tsv in managed code (by changing
the delimiter); I have used it a number of times without issue.

http://www.codeproject.com/cs/database/CsvReader.asp

Marc

Nov 10 '07 #5

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

Similar topics

10
5330
by: Yang Li Ke | last post by:
Hi guys! I have some datas that I must check everytime a visitor comes to my site What is better to do: 1- Read data from a file or 2- Read data from a mysql db Thank you
10
2288
by: ZafT | last post by:
Thanks in advance for any tips that might get me going in the right direction. I am working on a simple exercise for school that is supposed to use read to read a file (about 10 MB). I am supposed to change the buffer size and see how this affects the read time. In other words, the buffer is supposed to limit how much of the file gets read per call, and cause some change in speed. I am supposed to do the same with fread as well, but...
1
6768
by: cnu | last post by:
My program generates a log file for every event that happens in the program. So, I open the file and keep it open till the end. This is how I open the file for writing: <CODE> public CLogHandler() { this.m_fsLog = new FileStream(strTodaysLogFile, System.IO.FileMode.Append, System.IO.FileAccess.Write, System.IO.FileShare.Read); this.m_swLog = new StreamWriter(this.m_fsLog);
4
2747
by: ESPN Lover | last post by:
Below is two snippets of code from MSDN showing how to read a file. Is one way preferred over the other and why? Thanks. using System; using System.IO; class Test { public static void Main()
8
23907
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
5
3305
by: lovecreatesbea... | last post by:
The condition at line 31 is added to check if the program finished to read the whole file. Is it needed and correct? Thank you. #include <fstream> #include <iostream> #include <string> using namespace std; int read(string filename, int last_pos) {
6
32919
by: Thomas Kowalski | last post by:
Hi, currently I am reading a huge (about 10-100 MB) text-file line by line using fstreams and getline. I wonder whether there is a faster way to read a file line by line (with std::string line). Is there some way to burst read the whole file and later "extract" each line? Thanks in advance, Thomas Kowalski
9
7385
by: flebber | last post by:
I was working at creating a simple program that would read the content of a playlist file( in this case *.k3b") and write it out . the compressed "*.k3b" file has two file and the one I was trying to read was maindata.xml . I cannot however seem to use the gzip module correctly. Have tried the program 2 ways for no success, any ideas would be appreciated. Attempt 1 #!/usr/bin/python
2
5454
by: Kevin Ar18 | last post by:
I posted this on the forum, but nobody seems to know the solution: http://python-forum.org/py/viewtopic.php?t=5230 I have a zip file that is several GB in size, and one of the files inside of it is several GB in size. When it comes time to read the 5+GB file from inside the zip file, it fails with the following error: File "...\zipfile.py", line 491, in read bytes = self.fp.read(zinfo.compress_size) OverflowError: long it too large to...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
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
10049
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
9997
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
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
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...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3965
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
3565
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.