首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

checkbox有关问题

2012-05-28 
checkbox问题在窗体界面上,我如果单击Checkbox则表示选中,数据库的字段类型中有bit,我怎么把这个值传给bit

checkbox问题
在窗体界面上,我如果单击Checkbox则表示选中,数据库的字段类型中有bit,我怎么把这个值传给bit。让数据库更新为true。

[解决办法]
int i = Convert.ToInt32(checkbox1.Checked);
"update xxxx set bitfield="+i.ToString();
[解决办法]
bit对应的就是bool.

因此用
CheckBox.Checked Property

Gets or set a value indicating whether the CheckBox is in the checked state.
http://msdn.microsoft.com/en-us/library/system.windows.forms.checkbox.checked.aspx


热点排行