Hi anyone know how to read csv file and store its content to sql db using LINQ and WCF, I read few articles but i can't able to comprehend. I am looking for a beginner tutorial.
Below are the articles I found:
You could start off with a .net console app or a web app anything that is convenient. The code will be the same in WCF.
It'd be a good idea to split your requirements & then go for it. something like
1 read a file from the disk.
2 have that file in a datatable , generic list or something like that.
3 save a datatable/ List to a database
To get started , here's how you can read a fie using LINQ.
var mycsv = from x in File.ReadAllLines("D:\\\\mycsvfile.csv") select x;
Only tricky part is parsing the CSV here -- check out FileHelpers, it solves that for you.
You probably want to skip WCF if you are just reading a CSV file and stuffing it in a database. Unless the database is on a remote host.