How do I get the value of a checkbox?

  • Thread starter Thread starter needin4mation
  • Start date Start date
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.
 
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
 
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.
 
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

Back
Top