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

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.

Quick question:

Are you wanting C# or C? C is not the same language as C#.

Hi alc6379,

I'll be using C for this assignment

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.