110,535
社区成员
发帖
与我相关
我的任务
分享
private void DataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if ((e.RowIndex >= 0)&&(e.ColumnIndex==0))//表格第一列
{
DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)DataGridView1.Rows[e.RowIndex].Cells["jd_check"];
Boolean flag = Convert.ToBoolean(checkCell.Value);//判断是否已选
if (flag)
{
checkCell.Value = false;
}
else
{
checkCell.Value = true;
}
}
}
select case checked when 'Y' then 'true' when 'N' then 'false' end chekced from table
select case checked when 'Y' then 'true' when 'N' then 'false' end from table
DataSet SqlDS = new DataSet();
SqlDataAdapter SqlDA = new SqlDataAdapter("Select Null As [Check],字段1,字段2 From 表名", 连接句柄);
SqlDA.Fill(SqlDS);
DataView tblcomponents = SqlDS.Tables[0].DefaultView;
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = tblcomponents;
Column1.DataPropertyName = "Check";
Column2.DataPropertyName = "字段1";
Column3.DataPropertyName = "字段2";
DataSet SqlDS = new DataSet();
SqlDataAdapter SqlDA = new SqlDataAdapter("Select Null As [Check],字段1,字段2 From 表名", 连接句柄);
SqlDA.Fill(SqlDS);
DataView tblcomponents SqlDS.Tables[0].DefaultView;
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = tblcomponents;
Column1.DataPropertyName = "Check";
Column2.DataPropertyName = "字段1";
Column3.DataPropertyName = "字段2";