How do I get the value of a checkbox?

N

needin4mation

I am trying to input the value of a checkbox in a database. If it it
true I want 1, false 0. I know I can write a function to do this, but
thought that wasn't right. Comments welcome. Thanks.
 
K

Karl Seguin

Is this an SQL Server Bit column? if so, assigning true/false to your
command's parameter should work.

If it's access, you might need to change the Yes/No format to True/False.

Karl
 
N

needin4mation

Not sure what you are telling me to do. I am using MySQL and it has a
1 or 0, so I have to change the checked to that.
 
S

sreejith.ram

Karl asked, whether the datatype of this column in SQL Server table is
BIT
if so, you could directly assign the value of the CheckBox.Checked
property

if not, you need code like

if (CheckBox.Checked)
paramvaluefordb= "1";
else
paramvaluefordb= "0";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top