private void OpenEditCustomerDialog(string obj) { var editCustomerDialog = new EditCustomerDialog(db, SelectedCustomer); if (editCustomerDialog.ShowDialog() == true) { editCustomerDialog.EditCustomer(); Customers = db.Customers.AsObservableCollection(); } }
private void button2_Click(object sender, EventArgs e) { var editDialog = new EditCustomerDialog(customers, (dataGridView1.CurrentRow.DataBoundItem as DataRowView).Row); editDialog.ShowDialog(); commandBuilder = new SqlCommandBuilder(adapter1); adapter1.UpdateCommand = commandBuilder.GetUpdateCommand(); label1.Text = commandBuilder.GetUpdateCommand().CommandText; adapter1.Update(shopDB, "Customers"); customers.Clear(); adapter1.Fill(shopDB); }