private void SaveToFile(object sender, EventArgs args) { SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = dialog.Filter = "xls files (*.xls)|"; dialog.RestoreDirectory = true; UpdateStatus("Saving urls to file.", true); try { if (dialog.ShowDialog() == DialogResult.OK) { OleDbHelper helper = new OleDbHelper(); helper.CreateTableIfNotExists(dialog.FileName, "URLS"); foreach (var scrapedData in urls) { helper.InsertRow(dialog.FileName, scrapedData.WebsiteUrl, scrapedData.Root, scrapedData.Email, scrapedData.PhoneNumber, scrapedData.CompanyName); } UpdateStatus("File saved."); } } catch (Exception ex) { UpdateStatus(ex.Message); } StartTimer(); }
private void Save(string filepath) { OleDbHelper helper = new OleDbHelper(); helper.CreateTableIfNotExists(filepath, "URLS"); foreach (var scrapedData in urls) { helper.InsertRow(filepath, scrapedData.WebsiteUrl, scrapedData.Root, scrapedData.Email, scrapedData.PhoneNumber, scrapedData.CompanyName); } }