日期:2014-05-18  浏览次数:20689 次

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