我正在尝试显示数据库中的值。文本框值显示成功但复选框值未显示,并显示错误。我收到此屏幕截图中显示的错误:错误信息我的代码:sql = "select * from repair where repairid = '" + repairid + "'";SqlCommand cmd = new SqlCommand(sql, con);SqlDataReader dread;con.Open();dread = cmd.ExecuteReader();while (dread.Read()){ checkBox7.CheckState = dread[6].ToString();}
1 回答
暮色呼如
TA贡献1853条经验 获得超9个赞
if(dread[6].ToString = = "True")
{
CheckBox7.Checked = "true";
}
else
{
CheckBox7.Checked = "false";
}
- 1 回答
- 0 关注
- 65 浏览
添加回答
举报
0/150
提交
取消