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

!checkedlistbox有关问题

2013-01-18 
求助!!checkedlistbox问题for (int d 0 d checkedListBox1.Items.Count d++){if (checkedListBox1.G

求助!!checkedlistbox问题
for (int d = 0; d < checkedListBox1.Items.Count; d++)
            {
                if (checkedListBox1.GetItemChecked(d))
                {
                    string st = this.checkedListBox1.Items.ToString();
                    string str3 = "insert into bingli(哮喘症状) values('" + st + "') ";
                    SqlCommand com3 = new SqlCommand(str3, con);
                    com3.ExecuteNonQuery();
                }
            }

要将选中的checkedlistbox的内容存入数据库,但是以上代码运行有误,求查看。。。。
数据库连接已经写在前面了。。
[解决办法]
病人编号这一列不能为空?那就赋个默认值啊
[解决办法]
 string st1 = this.checkedListBox2.CheckedItems[c].ToString();
=>
 string st1 = this.checkedListBox2.Items[c].ToString();

热点排行