Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将单选按钮值从SQLServer获取到C中#_C#_Sql Server - Fatal编程技术网

C# 如何将单选按钮值从SQLServer获取到C中#

C# 如何将单选按钮值从SQLServer获取到C中#,c#,sql-server,C#,Sql Server,我对使用C#代码将SQL Server数据库中的单选按钮值输入表单感到有点困惑 以下是一个例子: if (optIsActiveYes.Checked) { optIsActiveYes.Value = dt.Rows["Yes"].ToString(); } 请帮我举个例子 谢谢。这就是你想要做的吗 optIsActiveYes.Checked = Convert.ToBoolean(dt.Rows["Yes"]); 请试试这个。这是提到的radiobutton和radi

我对使用C#代码将SQL Server数据库中的单选按钮值输入表单感到有点困惑

以下是一个例子:

if (optIsActiveYes.Checked) { 
    optIsActiveYes.Value = dt.Rows["Yes"].ToString(); 
} 
请帮我举个例子


谢谢。

这就是你想要做的吗

optIsActiveYes.Checked =  Convert.ToBoolean(dt.Rows["Yes"]); 

请试试这个。这是提到的radiobutton和radiobuttonlist

如果(RadioButton1.选中)


我现在很困惑。您的意思是表中有一个位字段吗?您能发布一些您已经编写的代码来完成这项工作吗?嗨。。如果(optIsActiveYes.Checked){optIsActiveYes.Value=dt.Rows[“Yes”].ToString();}@indra:请不要在注释中发布代码!这真的很难阅读-相反:通过编辑来更新你的原始问题!!
    { string str1 = RadioButton1.Text; }

    if (RadioButtonList1.SelectedIndex > -1)

    { string str2 = RadioButtonList1.SelectedItem.Text; }