private void OK_Click(object sender, EventArgs e) { int i; string s = string.Empty; //循环找出选中项 for (i = 0; i <= (checkedListBox.Items.Count - 1); i++) { if (checkedListBox.GetItemChecked(i)) { s = s + hyset.userSecurity(sql).Rows[i]["s_QID"].ToString() + ","; } } HY_Model.User uset = new HY_Model.User(); uset.Security = s; int res = hyset.userSecurityUpdate(uset, this.comboBoxuserName.Text); if (res > 0) { MessageBoxEx.Show("权限分配成功,确认后请重新启动系统!", this.comboBoxuserName.Text + "用户权限分配", MessageBoxButtons.OK); this.Close(); } }