要检索的复选框 [英] Checkbox to retrieve
问题描述
在我的数据库中,我有一些字段已填充是或否。字段Medical在数据库的后端填充值是或否,而在表单上有一些字段带有复选框,如医疗标签上的复选框,如果检查则表示医疗津贴被授予对于那个特别的人没有,现在我想在这个复选框的帮助下显示表格上的数据,如果在数据库中是的,我如何检查表格的复选框。
while我正在使用这样的代码。
我尝试过:
如果Rs(医疗)。值=是或是则
CheckBox1.Checked = True
否则
CheckBox1。 Checked = False
结束如果
In my database i have some fields which is already filled with Yes or No like. A field Medical is filled with value "Yes" or "No" at the back end in data base while on the form there are some fields with check boxes like a check box against the medical label and if it is checked means medical allowance is granted to that particular person else not, now i want to show the data on the form with the help of that check box if it is yes in data base how i check the check box of the form.
while i am using such codes.
What I have tried:
if Rs("Medical").Value = "Yes" Or "yes" Then
CheckBox1.Checked = True
Else
CheckBox1.Checked = False
End If
推荐答案
你也可以写:
you could also write :
CheckBox1.Checked = (Rs("Medical").Value.toString.toLower = "yes")
这是你的问题......?
Was this your Problem ...?
而不是
if Rs("Medical").Value = "Yes" Or "yes" Then
它应该是
If Rs("Medical").Value = "Yes" Or Rs("Medical").Value = "yes" Then
如果可能的话,你应该清理数据库。
最小的,试着寻找负责插入这些模糊值的脚本并使其正确。
祝你好运。
+++++ [第2轮] +++++
根据您的反馈,输入的是一些数据输入员工以自由文本形式,然后祝你好运,它可能会变成是, yes,yes ,.. 。等等。你知道了吗?
在这种情况下,你可以调整价值,看看结果如何:
If possible, you should clean up the database.
Minimally, try to look for that script that is responsible for inserting such vague values and make it right.
Good luck.
+++++[round 2]+++++
Based on your feedback, it is entered by some data entry staff in free text form, then good luck to your, it may turn out to be "YES", " yes", "yes ", ...etc. You got it?
In such cases, you can trim the value and see how it turns out:
Rs("Medical").Value.Trim()
事实上,它应该是第一个,检查Rs的值(医疗)。值通过 Visual Basic .NET调试 [ ^ ]。
这篇关于要检索的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!