hiii friends i am developing a windows application in c#,in that i have 2 radio buttons named male and female.....how to insert the selected value to my database.........
any help is very much appreciated
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Dec 25, 2009, 2:26 AM EST
its Simple to Store Radio Button Value In SQL server take Bit Data type to store the value of Radio Button in to Database
Now if Bit = 1 then male and Bit=0 then female .
in coding
int x ;
if ( RadioButton1.Checked == true)
{
x = 1;
}
else if(RadioButton2.Checked == true)
{
x=0;
}
// Now Use X in Insert Statement to fill the value of that Bit Column :)
manoj kumar124 reputationPosted Dec 26, 2009, 7:56 PM EST
string a;
if(RadioButton1.Checked==true)
{
a="Female";
}
else if(RadioButton2.Checked==true)
{
a="Male";
}
And in SourceCode
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="a" Text="Female" />
<asp:RadioButton ID="RadioButton2" runat="server" GroupName="a" Text="Male" />