我正在嘗試顯示數(shù)據(jù)庫(kù)中的值。文本框值顯示成功但復(fù)選框值未顯示,并顯示錯(cuò)誤。我收到此屏幕截圖中顯示的錯(cuò)誤:錯(cuò)誤信息我的代碼: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貢獻(xiàn)1853條經(jīng)驗(yàn) 獲得超9個(gè)贊
if(dread[6].ToString = = "True")
{
CheckBox7.Checked = "true";
}
else
{
CheckBox7.Checked = "false";
}
- 1 回答
- 0 關(guān)注
- 91 瀏覽
添加回答
舉報(bào)
0/150
提交
取消