且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

radiobuttionlist asp.net将数据发送到数据库sql

更新时间:2023-01-01 17:01:01

不要将文本值发送到数据库...您可以将数字发送到数据库,例如
男性-0
女用-1

希望这有助于
Dont send text values to database... u can send numeric to database like
For Male - 0
For Female - 1

Hope this helps


以相同的方式尝试

try in the same way

<asp:RadioButtonList ID="rb_Isfresher" RepeatDirection="Horizontal"  runat="server"
OnSelectedIndexChanged="rb_Isfresher_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem Text="Yes" Value="0" Selected="True">
<asp:ListItem Text="No" Value="1">




//在
后面的代码中




//in the code behind

Boolean strIsFresher ;
 
 if (rb_Isfresher.SelectedValue == "1")
       {
           strIsFresher = true;
        }
   else
        {
          strIsFresher = false; 


}

//将布尔值发送到数据库


}

// Send Boolean value to the Database