private async void button1_Click(object sender, EventArgs e) { using (var db = new AstronomyLogsEntities()) { foreach (AstronomyEntry entry in AstronomyParser.fillSQLEntry(dt)) { db.AstronomyEntries.Add(entry); } db.SaveChanges(); } }
private void btnOpen_Click(object sender, EventArgs e) { string selectedFile = ""; OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Title = "Open csv file"; fileDialog.InitialDirectory = @"c:\"; fileDialog.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"; if (fileDialog.ShowDialog() == DialogResult.OK) { selectedFile = fileDialog.FileName; } dt = AstronomyParser.readCSV(selectedFile); gridView.DataSource = dt; }