在dategridview中选中多行checkbox把选定的内容输出到水晶报表中,现在就是选择一行能输出,多行就不知道怎么写了,请哥哥姐姐们指教谢谢
下面是部分代码:
               
              private void button2_Click(object sender, EventArgs e)
        {
         
            int index = dataGridView1.CurrentRow.Index;            
            foreach (DataGridViewRow dr in dataGridView1.Rows)
            {
                try
                {
                    if((bool)dr.Cells[0].FormattedValue)
                    {
                        for (int i = 0; i < dataGridView1.Rows.Count; i++)
                        {
                            DataRow ddr = ds.Tables[0].Rows[index];
                            id = Int16.Parse(ddr[0].ToString());
                            string sql = "select * from sellcare where id ='" + id + "' or id = '"+id+"'";
                            ds = dt.Ds(sql, "sellcare"); 
                        }
                    }
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
               
            }
            baobsellok open = new baobsellok(ds);
            open.ShowDialog();