944,181 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 10858
  • C# RSS
Jul 28th, 2006
0

read text file

Expand Post »
Hi all,

I'm a newbie in C..Right now, I have to write a code to read a text file and then insert all the info inside that text file into database. Should anyone have a simple sample of it, maybe you can share with me in order for me to learn on how to do it.

Thanks in advance
Similar Threads
Reputation Points: 16
Solved Threads: 0
Light Poster
whitemoss is offline Offline
32 posts
since Jul 2006
Jul 28th, 2006
0

Re: read text file

First of all declare some library as:
Using System.IO;

So that you have acces to files, than write something like:
StreamReader sr = new StreamReader(@"yourpathandfilewithextension)";
string containsoffile = sr.ReadToEnd();
sr.Close();

So now you have all the file into string declared above. Regarding the database is more to it. Try to figure out first of all to which type of database you want to register data (ms sql, mysql, oracle, access etc), than regarding this find appropriate provider, mysqlclient, oracleclient, sqlclient or for both oracle and ms sql you could use oledbclient.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
AndiOliver is offline Offline
2 posts
since Jul 2006
Jul 30th, 2006
0

Re: read text file

Quick question:

Are you wanting C# or C? C is not the same language as C#.
Team Colleague
Reputation Points: 186
Solved Threads: 147
Cookie... That's it
alc6379 is offline Offline
2,519 posts
since Dec 2003
Jul 31st, 2006
0

Re: read text file

Hi alc6379,

I'll be using C for this assignment

Thanks
Reputation Points: 16
Solved Threads: 0
Light Poster
whitemoss is offline Offline
32 posts
since Jul 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: need to make setup with msde
Next Thread in C# Forum Timeline: Login page help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC