本文介绍了在SQL DB中选中/取消选中C#Numeric radiobutton ExecuteReader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有2个radiobuttons,它们将数字数据类型中的0或1插入到SQL DB中,我想知道当我用这段代码执行它时如何制作我的RadioButton public void chyt_data(){ SqlCommand novyprikaz = new SqlCommand( SELECT * FROM zajezd WHERE akce = + nc_zajezd_vyber,spojeni); spojeni.Open(); SqlDataReader precti = novyprikaz.ExecuteReader(); if (precti.Read()) { rb_a.Text = precti.GetDecimal( 32 )的ToString(); } 当数值为0时,我想检查radiobutton_a,如果值为1,我想检查radiobutton_b。 两个按钮都在面板中。 感谢提前帮助!解决方案 试试这个 CheckBox1.Checked = Convert.ToInt32(precti.GetDecimal(32).ToString())> 0; I have 2 radiobuttons which inserts 0 or 1 in numeric data type into SQL DB, I wonder how to make my RadioButton when I execute it with this code public void chyt_data() { SqlCommand novyprikaz = new SqlCommand("SELECT * FROM zajezd WHERE akce="+nc_zajezd_vyber, spojeni); spojeni.Open();SqlDataReader precti = novyprikaz.ExecuteReader(); if (precti.Read()) {rb_a.Text = precti.GetDecimal(32).ToString();} When the numeric value is 0 I would like radiobutton_a checked and if the value is 1 I'd like to have checked radiobutton_b.Both buttons are in a panel. Thanks for helping in advance! 解决方案 Try this CheckBox1.Checked = Convert.ToInt32(precti.GetDecimal(32).ToString()) > 0; 这篇关于在SQL DB中选中/取消选中C#Numeric radiobutton ExecuteReader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-15 00:36