I am trying to display the values from database. The textbox values are displayed successfully but checkbox values are not displayed, and it shows the error. i attached the error on screenshot image below
- 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();
- }

Rupesh KahanePosted Apr 22, 2019, 12:47 AM
In while loop do some modifications for property Checked , is an boolean value so make it as true / false
CheckBox.Checked= true
will work fine
Jignesh KumarPosted Apr 21, 2019, 12:46 PM
Amit KumarPosted Apr 21, 2019, 12:12 PM
Praveen MauryaPosted Apr 21, 2019, 11:09 AM
Kobinath RamPosted Apr 21, 2019, 10:55 AM
Praveen MauryaPosted Apr 21, 2019, 10:21 AM