read text file

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2006
Posts: 32
Reputation: whitemoss is an unknown quantity at this point 
Solved Threads: 0
whitemoss whitemoss is offline Offline
Light Poster

read text file

 
0
  #1
Jul 28th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 2
Reputation: AndiOliver is an unknown quantity at this point 
Solved Threads: 0
AndiOliver's Avatar
AndiOliver AndiOliver is offline Offline
Newbie Poster

Re: read text file

 
0
  #2
Jul 28th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: read text file

 
0
  #3
Jul 30th, 2006
Quick question:

Are you wanting C# or C? C is not the same language as C#.
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 32
Reputation: whitemoss is an unknown quantity at this point 
Solved Threads: 0
whitemoss whitemoss is offline Offline
Light Poster

Re: read text file

 
0
  #4
Jul 31st, 2006
Hi alc6379,

I'll be using C for this assignment

Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC