0

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

3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by whitemoss
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.