private void buttonlj_del_Click(object sender, EventArgs e) { foreach (DataGridViewRow dr in dgvljjl.SelectedRows) { int will_del_id = Convert.ToInt32(dr.Cells["id"].Value); del_list_for_part.Add(will_del_id); dgvljjl.Rows.Remove(dr); } return; // 获得选中行 int index = this.dgvljjl.CurrentCell.RowIndex; if (index >= 0 && index < this.dgvljjl.Rows.Count) { var id = this.dgvljjl.Rows[index].Cells["id"].Value; Maticsoft.BLL.parts parts_bll = new Maticsoft.BLL.parts(); if (parts_bll.Delete(Convert.ToInt32(id))) { MessageBox.Show("删除成功"); } else { MessageBox.Show("未删除成功"); } } requery2(); }
private void del_bt_Click(object sender, EventArgs e) { DataRow DR = gridView1.GetDataRow(gridView1.FocusedRowHandle); Maticsoft.BLL.parts use = new Maticsoft.BLL.parts(); use.Delete(Convert.ToInt32(DR["id"])); //MessageBox.Show(a["id"].ToString()); MessageBox.Show("删除成功"); Maticsoft.BLL.parts usec = new Maticsoft.BLL.parts(); DataSet ds = usec.GetAllList(); main_gc.DataSource = ds.Tables[0]; }
private void button3_Click(object sender, EventArgs e) { Maticsoft.BLL.parts comp_bll = new Maticsoft.BLL.parts(); foreach (int del_id in del_list_for_part) { if (comp_bll.Delete(del_id)) { // MessageBox.Show("删除成功"); } else { MessageBox.Show("没有删除成功"); } } MessageBox.Show("提交成功"); }