using System.IO;
..
List<string[]> parsedData = new List<string[]>();
string path = ConfigurationManager.AppSettings["FullPath"];
string filename = "myCsv.csv";
string fullpath = path + filename;
using (StreamReader readFile = new StreamReader(fullpath))
{
string line;
string[] row;
while ((line = readFile.ReadLine()) != null)
{
row = line.Split(';');
parsedData.Add(row);
}
}
if(parsedData.Count >= 1)
{
DataClasses1DataContext _db = new DataClasses1DataContext();
temp_table wm = new temp_table();
wm.FileName = filename;
_db.wms.InsertOnSubmit(wm);
_db.SubmitChanges();
for (int counter = 1; counter <= parsedData.Count; counter++)
{
temp_detail_table wd = new temp_detail_table();
wd.col1= (parsedData[counter][1];
wd.col2= (parsedData[counter][2];
..
_db.wds.InsertOnSubmit(wd);
_db.SubmitChanges();
}
}