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 PRank #280 · 8.8K reputationPosted Nov 17, 2017, 1:10 AM EST
Ramesh PalanivelRank #372 · 6.8K reputationPosted Nov 16, 2017, 9:12 PM EST
Ramesh PalanivelRank #372 · 6.8K reputationPosted Nov 16, 2017, 8:43 PM EST
Jyoti JodhaRank #1,408 · 1.2K reputationPosted Nov 16, 2017, 8:56 PM EST
Ramesh Palanivel
Jyoti JodhaRank #1,408 · 1.2K reputationPosted Nov 16, 2017, 9:15 PM EST