0
MySqlDataAdapter da = new MySqlDataAdapter("select * from mytable", con);
DataSet ds = new DataSet();
ds.Clear();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.Columns["id"].Visible = false;
dataGridView1.Columns["chk"].HeaderText ="Check";
这不起作用:如何将DataGridView的列的数据类型更改为CheckBox?
dataGridView1.Columns["chk"].CellTemplate = new DataGridViewCheckBoxCell();
您的字段的数据类型应该是'bit',所以你不需要创建一个'DataGridViewCheckBoxCell',如果是正确的:) – spajce 2012-12-16 15:30:21