results of a checkbox into sql database

  • Thread starter Thread starter Harold A. Mackey
  • Start date Start date
H

Harold A. Mackey

I'm having a time finding some examples of checkbox results in a database. I
first tried setting up the fields as bit in the stored procedures. I have
not been able to determine the output of a checkbox selection. It returns a
true or false state. I need to know the type that it returns and how to
store this in a database, or how to convert the state to a string value.
Many Thanks
HM
 
Harold said:
I'm having a time finding some examples of checkbox results in a database. I
first tried setting up the fields as bit in the stored procedures. I have
not been able to determine the output of a checkbox selection. It returns a
true or false state. I need to know the type that it returns and how to

Programmers call "true or false state" boolean type :)))
store this in a database, or how to convert the state to a string value.

???
Doesnt this work:

SqlCommand cmd = new SqlCommand();
cmd.Parameters.Add("@CheckBox1",_checkBox1.Checked);

create procedure sp_SaveCheckBoxes (@CheckBox1 bit)
as
....

Vadim Chekan.
 
In case anyone else runs into this, the consensus I have found is to store
the results in a int type and contsrain the field to 0 or 1. I think
converting the results in to bit stream and storing the bytes is the proper
way, but represents an awful lot of coding for very little savings in space.

Thks
Harold
 

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