private void btn_del_Click(object sender, EventArgs e) { int dgrow = dgv1.RowCount; string checkstr = ""; for (int i = 0; i < dgrow; i++) { if (dgv1.Rows[i].Cells[0].Value.ToString() == "1") { string partid = dgv1.Rows[i].Cells[3].Value.ToString(); checkstr = "checked"; } } if (checkstr == "") { MessageBox.Show("您还没有选择数据!"); return; } int seqNo = Convert.ToInt32(lbl_seqno.Text.ToString()); if (PartParameter.Delete(seqNo) > 0) { lbl_seqno.Text = string.Empty; MessageBox.Show("删除成功!"); } else { MessageBox.Show("删除失败!"); } QuerydataBind(); }