怎么点击dataGridView1内嵌的按钮删除一行数据呀,搞了一天没搞好、、
程序代码:
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if(dataGridView1.Columns[e.ColumnIndex].Name == "删除") { SqlConnection connect = new SqlConnection(@"Data Source=localhost;Database=controlcenter;user id=sa;password=sa123;"); SqlCommand command = new SqlCommand(); command.Connection = connect; connect.Open(); SqlDataAdapter adapter = new SqlDataAdapter(command); DataSet dataset1 = new DataSet(); }
不是新添加的按钮,是dataGridView1中添加的DataGridViewButtonColumn按钮。求大神指点,我弄了好久弄不好