private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var autorSelect = ((System.Data.DataRowView) this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row as MVCProject.SistemaBibliotecaDBDataSet.AutoresRow; switch (e.ColumnIndex) { case 0: { frmEdicaoAutores editAutor = new frmEdicaoAutores(); editAutor.AutoresRow = autorSelect; editAutor.ShowDialog(); this.autoresTableAdapter.UpdateQuery( editAutor.AutoresRow.Nome, editAutor.AutoresRow.Descricao, editAutor.AutoresRow.Id); // this.autoresTableAdapter.DeleteQuery(autorSelect.Id); } break; } this.autoresTableAdapter.CustomQuery(this.sistemaBibliotecaDBDataSet.Autores); }
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var AutSelect = ((System.Data.DataRowView) this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row as MVCProjectForms.SistemaBibliotecaDBDataSet.AutoresRow; switch (e.ColumnIndex) { case 0: { this.autoresTableAdapter.DeleteQuery1(AutSelect.Id); } break; case 1: { frmEdicaoAutores editAutor = new frmEdicaoAutores(); editAutor.AutoresRow = AutSelect; editAutor.ShowDialog(); this.autoresTableAdapter.Update(editAutor.AutoresRow); } break; } this.autoresTableAdapter.Fill(sistemaBibliotecaDBDataSet.Autores); }