如何在/从不同列的数据库中添加和检索多个复选框值 [英] how to add and retrive multiple checkbox value in/from database in different column

查看:52
本文介绍了如何在/从不同列的数据库中添加和检索多个复选框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个groupbox,其中有12个复选框,我想将其检查值属性存储在其他column.表中,但是我不知道该怎么做,请任何人帮助我

i have a groupbox in which there are 12 checkbox and i want to store its checked value property in a table in different column.but i dont know how to do, please anyone help me

推荐答案

您可以在数据库表中以布尔值或二进制类型创建12列(假设复选框的数量不会经常变化,并且经常更新数据库和代码),并存储如果从UI选中复选框,则为1或true,否则为0.同样,在检索值(如果列值为1)时,则选中相应的复选框,否则不进行检查.

这绝对是一种方法,但是也可能有一种更聪明的方法来实现此目的.希望这会有所帮助.

干杯.
You can create 12 columns (assuming the number of check-boxes is not going to change often resulting in an update to the database and code as well) in your database table as boolean or binary types and store 1 or true if the check-box was checked from the UI and 0 otherwise. Similarly, when retrieving the values if the column value is 1 then check the corresponding check-box else not.

This is definitely one way to do, but may be there is a cleverer way to achieve this as well. Hope this helps.

Cheers.


这篇关于如何在/从不同列的数据库中添加和检索多个复选框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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