且构网

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

如何在sql数据库中存储复选框值?

更新时间:2022-12-11 20:06:29

每个复选框都是一个简单的True / False值。除非您使用的是TriState复选框...



如果您使用的是普通复选框,则选中每个复选框使用一个数据库字段,或者你可以为每个复选框分配位标志值,然后或分配这些值并保存结果值。
Each checkbox is a simple True/False value. Unless you're using a TriState checkbox that is...

If you're using a normal checkbox, you check either use one database field for each checkbox, or you can assign bit flag values to each checkbox and "OR" those togther and save the resulting value.


希望这个帮助:



http://forums.asp.net/ t / 1324797.aspx / 1?问题+插入+复选框+值+进入+ SQL +数据库 [ ^ ]
hope this help :

http://forums.asp.net/t/1324797.aspx/1?Problem+inserting+Checkbox+value+into+SQL+database[^]






试试这个



在设计时在Checkbox中设置AutoPostBack =true并设置OnCheckedChanged事件,该事件将调用每当用户选择/取消选中CheckBox时代码后面的函数...



当OnCheckedChanged Ev时在后面的代码中调用ent,你可以编写你的代码,这将打到数据库,在此之前检查CheckboxName.Checked = True检查哪个复选框然后调用一个函数,它将检查Checkbox值插入数据库
Hi,

try this

set AutoPostBack="true" in Checkbox at design time and also set "OnCheckedChanged" event which will call the code behind function every time when user Select/Deselect CheckBox ...

SO when OnCheckedChanged Event is called in code behind you can write your code which will hit the database and before that check which checkbox is checked by CheckboxName.Checked = True and then call a function which will insert checked Checkbox value into database