标题:怎么点击dataGridView1内嵌的按钮删除一行数据呀,搞了一天没搞好、、
取消只看楼主
shengdong521
Rank: 1
等 级:新手上路
帖 子:4
专家分:7
注 册:2016-3-5
结帖率:100%
已结贴  问题点数:20 回复次数:2 
怎么点击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按钮。求大神指点,我弄了好久弄不好
2016-03-07 22:59
shengdong521
Rank: 1
等 级:新手上路
帖 子:4
专家分:7
注 册:2016-3-5
得分:0 
会的帮下忙吧,谢谢了!!!!!!!!!!!!!!!!!!!!
2016-03-08 11:12
shengdong521
Rank: 1
等 级:新手上路
帖 子:4
专家分:7
注 册:2016-3-5
得分:0 
回复 4楼 over1230
我就是写不好删除的指令呀。。。教下我吧
2016-03-10 15:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-462241-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.836144 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved