日期:2014-05-18 浏览次数:21121 次
string delete_No = this.dataGridView1.SelectedRows[0].Cells["编号"].Value.ToString();
string strConnect = Properties.Settings.Default.PopInfoConnectionString;
SqlConnection conConnection = new SqlConnection(strConnect);
conConnection.Open();
string cmd = "delete from [aaa] where id=" + delete_No + "";
SqlCommand com = new SqlCommand(cmd, conConnection);
{
com.ExecuteNonQuery();
this.dataGridView1.Rows.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
MessageBox.Show("记录已成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}