SqlConnection conn = new SqlConnection("server=(local);database=SimpleVote;uid=sa;pwd="); conn.Open(); for (int i = 0; i < CheckBoxList1.Items.Count; i++) { if (CheckBoxList1.Items[i].Selected){ SqlCommand add = new SqlCommand("update VoteItem set ItemCount=ItemCount+1", conn); add.ExecuteNonQuery(); } }
C# checkboxlist 写入数据库
最新推荐文章于 2022-11-08 11:56:47 发布