How to retrieve data from database to radiobutton in Windows Form C#
I saved radiobutton value in database like "A4Size" or "A5Size".Now i want to retrieve that data from database to radiobutton.If A4Size in database i want to check the Radionbutton (A4Size) value other wise uncheck the radiobutton (A5Size) value.
Code Like this
private void BillLoad()
{
DataTable dt = new DataTable();
con.Open();
SqlDataReader myReader = null;
SqlCommand myCommand = new SqlCommand("select * from Bill ", con);
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
if (myReader["ReportSize"].ToString() == "A4_Size")
{
ChhkA4.Checked = true;
}
else
{
ChhkA5.Checked = true;
}
}
con.Close();
}

Rafnas T PPosted Nov 17, 2017, 6:10 AM
Jyoti JodhaPosted Nov 17, 2017, 2:15 AM
Ramesh PalanivelPosted Nov 17, 2017, 2:12 AM
Jyoti JodhaPosted Nov 17, 2017, 1:56 AM
Ramesh Palanivel
Ramesh PalanivelPosted Nov 17, 2017, 1:43 AM