【发布时间】:2011-04-10 11:43:33
【问题描述】:
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";
这不起作用:
dataGridView1.Columns["chk"].CellTemplate = new DataGridViewCheckBoxCell();
【问题讨论】:
-
你的字段的数据类型应该是
bit,所以你不需要创建一个DataGridViewCheckBoxCell,如果正确的话:)