private void UpdateFinishing(object sender, EventArgs e) { try { SaveTableAdapter updateAdapter = new SaveTableAdapter(); SaveDataSet updateDataSet = new SaveDataSet(); updateAdapter._ConectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\" + _nameDownloadedFile + ";Integrated Security=True;Connect Timeout=30;User Instance=True"; updateAdapter.Fill(updateDataSet.Save); #if DEBUG IEnumerable<string> testList = from s in updateDataSet.Save select s.Name; IEnumerable<string> testListOriginal = from s in _saveDataSet.Save select s.Name; #endif _saveDataSet.Save.Merge(updateDataSet.Save); #if DEBUG IEnumerable<string> testListOriginal1 = from s in _saveDataSet.Save select s.Name; #endif } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { _saveDataSetSaveTableAdapter.Update(_saveDataSet.Save); } }
private void InicializeDataSet() { _saveDataSet = ((SaveDataSet)(FindResource("saveDataSet"))); // Load data into the table Save. You can modify this code as needed. _saveDataSetSaveTableAdapter = new SaveTableAdapter(); _saveDataSetSaveTableAdapter.Fill(_saveDataSet.Save); CollectionViewSource saveViewSource = ((CollectionViewSource)(FindResource("saveViewSource"))); saveViewSource.View.MoveCurrentToFirst(); #if iDEBUG _saveDataSetSaveTableAdapter.Connection.Close(); _saveDataSet.Dispose(); _saveDataSetSaveTableAdapter.Dispose(); ((CollectionViewSource) (FindResource( "saveViewSource" ))).Source = null; _saveDataSet = null; _saveDataSetSaveTableAdapter = null; saveViewSource.Source = null; saveViewSource = null; #endif _saveDataSet.Save.RowChanged += DataSetRowEditedEventHandler; }