Hi,
if in the GroupBox "GroupSex" are only 2 RadioButtons you can use only one instruction instead of two:
cmd.Parameters.Add("@petGender", SqlDbType.VarChar, 40).Value = (radioMale.IsChecked) ? radioMale.Content : radioFemale.Content;
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
he question is whether I have two or more radiobuttons the same group in this case RadioMale and Radio Female. The value you enter in the table can be one of two petgender options in the Sql statement.
<RadioButton x:Uid="RBVaron" x:Name="radioMale" Grid.Row="22" Grid.Column="0" GroupName="GroupSex" Content="Male"/>
<RadioButton x:Uid="RBHembra" x:Name="radioFemale" Margin="150,-32,0,0" Grid.Row="22" Grid.Column="0" GroupName="GroupSex" Content="Female"/>
cmd.Parameters.Add("@petGender", SqlDbType.VarChar, 40).Value = radioMale.Content;
cmd.Parameters.Add("@petGender", SqlDbType.VarChar, 40).Value = radioFemale.Content;
Hi,
if in the GroupBox "GroupSex" are only 2 RadioButtons you can use only one instruction instead of two:
cmd.Parameters.Add("@petGender", SqlDbType.VarChar, 40).Value = (radioMale.IsChecked) ? radioMale.Content : radioFemale.Content;
this is the soluction if(radioMale.IsChecked == true) { rbGender = "0"; cmd.Parameters.Add("@petGender", SqlDbType.VarChar, 40).Value = radioMale.Content; } if(radioFemale.IsChecked == true) { rbGender = "1"; cmd.Parameters.Add("@petGender", SqlDbType.VarChar, 40).Value = radioFemale.Content; }