private void button4_Click(object sender, EventArgs e) { ProductMaterial pmt = new ProductMaterial(); pmt.MaterialId = textBox原料.Text; pmt.ProductId = textBox产品.Text; pmt.MaterialCount = Convert.ToInt16(textBox原料数量.Text); if (pm.DelMaterialProductRelation(pmt)) { MessageBox.Show("删除成功"); dataGrid产品原料关系.Rows.Remove(dataGrid产品原料关系.CurrentRow); } else { MessageBox.Show("删除失败!"); } }