如何将两组中的单选按钮值保存在数据库中 [英] How to save radio buttons value in database which are in two groups
本文介绍了如何将两组中的单选按钮值保存在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将成组的单选按钮值保存在数据库中
How to save radio buttons value in database which are in groups
推荐答案
您好,
您可以尝试定义具有Group Id
和Button Id
列的表,并在需要时相应地填充它们.
问候
Hi,
you might try defining a table withGroup Id
andButton Id
columns, and populate them accordingly when you find the need of doing so.
regards
private void button1_Click(object sender, EventArgs e)
{
string s = "rbtnManagingPerformance = " + GetValue(rbtnManagingPerformance0, rbtnManagingPerformance1, rbtnManagingPerformance2, rbtnManagingPerformance3);
string s1 = "rbtnCreatingMotivationEnvironment = " + GetValue(rbtnCreatingMotivationEnvironment0, rbtnCreatingMotivationEnvironment1, rbtnCreatingMotivationEnvironment2, rbtnCreatingMotivationEnvironment3);
MessageBox.Show(s + "\r\n" + s1);
}
=============================================
private string GetValue(RadioButton r0, RadioButton r1, RadioButton r2, RadioButton r3)
{
string s = string.Empty;
RadioButton[] rbtn = { r0, r1,r2, r3};
foreach (RadioButton rb in rbtn)
{
if (rb.Checked == true)
{
s = rb.Text;
break;
}
else
s = "";
}
return s;
}
这篇关于如何将两组中的单选按钮值保存在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文