private void button1_Click(object sender, EventArgs e) { try { DB_functions fun = new DB_functions(); DB_functions.Fields_Track fields = new DB_functions.Fields_Track(); fields.f1 = txtDescription.Text; fields.f2 = txtStops.Text; fields.f3 = int.Parse(txtTime.Text); fields.f4 = chbCity.Checked; DateTime time = DateTime.Parse(dtpCreate.Value.ToString("dd.MM.yyyy")); fields.f5 = time; fields.f6 = false; fun.Save(fields); dsTableAdapters.TrackTableAdapter taT = new dsTableAdapters.TrackTableAdapter(); taT.Update(ds.Track); this.Close(); } catch (Exception E) { MessageBox.Show("Невозможно сохранить", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void маршрутыToolStripMenuItem_Click(object sender, EventArgs e) { frmAdmin frm = new frmAdmin(); dsTableAdapters.TrackTableAdapter ta = new dsTableAdapters.TrackTableAdapter(); ta.Fill(ds.Track); frm.dgvAdmin.DataSource = ds.Track; frm.dgvAdmin.Update(); frm.ShowDialog(); ta.Update(ds.Track); }