Доброй ночи...(утра)
Я уже ничего не понимаю. Что-то же из этого должно сохранять изменения в datagridview
(1) пыталась через отдельную форму
MessageBox.Show("save new auditories");
SqlCommand command = new SqlCommand("INSERT into [Auditoriya]('[№ аудитории]','[тип аудитории]','[id ответственного]')values([№ аудитории],[тип аудитории],[id ответственного])", sqlConnection);
command.Parameters.AddWithValue("[№ аудитории]",num_аудиторииTextBox.Text);
command.Parameters.AddWithValue("[тип аудитории]", тип_аудиторииTextBox.Text);
command.Parameters.AddWithValue("[id ответственного]", id_ответственногоComboBox.Text);
this.auditoriyaBindingSource.EndEdit();
(2) это в самой datagv
private void EndEditOnAllBindingSources()
{
var BindingSourcesQuery =
from Component bindingSources in this.components.Components
where bindingSources is BindingSource
select bindingSources;
foreach (BindingSource bindingSource in BindingSourcesQuery)
{
bindingSource.EndEdit();
}
}
private void сохранитьToolStripButton_Click(object sender, EventArgs e)
{
EndEditOnAllBindingSources();
this.inventarTableAdapter.Update(this.databaseUDDataSet.Inventar);
this.auditoriyaTableAdapter.Update(this.databaseUDDataSet.Auditoriya);
this.documentTableAdapter.Update(this.databaseUDDataSet.Document);
this.otvetTableAdapter.Update(this.databaseUDDataSet.Otvet);
this.proverTableAdapter.Update(this.databaseUDDataSet.Prover);
this.inventarisationTableAdapter.Update(this.databaseUDDataSet.Inventarisation);
this.remontTableAdapter.Update(this.databaseUDDataSet.Remont);
this.spisokTableAdapter.Update(this.databaseUDDataSet.Spisok);
this.auditoriyaBindingSource.EndEdit();
this.inventarBindingSource.EndEdit();
this.documentBindingSource.EndEdit();
this.otvetBindingSource.EndEdit();
this.proverBindingSource.EndEdit();
this.inventarisationBindingSource.EndEdit();
this.remontBindingSource.EndEdit();
this.spisokBindingSource.EndEdit();
}