private void button10_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "确认要删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { ProductManage deleteproduct = new ProductManage(); int id = Convert.ToInt32(dataGridView2.CurrentRow.Cells[0].Value); int tt = deleteproduct.deleteProduct(id); if (tt == 1) { MessageBox.Show("删除成功!", "提示"); GetData(dataAdapter.SelectCommand.CommandText); } } }