如何在c#中使用或插入检查列表框如何在sql数据表的listbox中插入每个复选框 [英] how to use or insert check list box in c# how to insert each checkbox in listbox in sql data table

查看:73
本文介绍了如何在c#中使用或插入检查列表框如何在sql数据表的listbox中插入每个复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个项目,我已经在C#中了解了一个清单一个清单框如何存储每个检查值我检查列表框的sql表

I AM WORKING ON A PROJECT IN WHICH I HAVE FRONTEND IN C# THAT CONTAN A checklist box how can i store each checked value i sql table of that check list box

推荐答案

这取决于具体情况。即使复选框位于列表中,如果复选框的数量是静态的并且每个复选框的含义已知且影响程序逻辑,您可以考虑将每个复选框存储在单独的(位)列中。



但是,最合适的解决方案是将它们作为行存储在表中,每个选择都代表一个新行。如果已知每个复选框的含义,则可以使用对查找表的引用来枚举可能的值。



所以基本上类似于



It depends on the situation. Even though the check boxes are in a list, if the amount of the check boxes is static and the meaning of each check box is known and affects program logic, you could consider storing each in a separate (bit) column.

However, most likely a suitable solution would be to store them in a table as rows, each selection would represent a new row. If the meaning of each check box is known, you can use a reference to a lookup table which would enumerate possible values.

So basically something like

CheckBoxEnum
- EnumerationValue int, primary key
- Description, varchar 
- ...

CheckBoxSelection
- EnumerationValue, int, foreign key
- ...





另外你可以添加引用主表的正确外键(如果有的话)。



In addition you can add proper foreign keys that reference to a master table if you have one.


这篇关于如何在c#中使用或插入检查列表框如何在sql数据表的listbox中插入每个复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆