Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

how to save checkbox as a true or false in database

$
0
0

hi, i am newbie in c# windows form programming. i am working on project that have too many checkboxes name as checkbox1, checkbox2, checkbox3 ..... checkbox63.

how can i save, if user checked the checkbox then save value as a "true" in database and if user unchecked the checkbox then save value as a "false" in database.

i have 63 check boxes, how can i saved them in database.

i try this code. but i want to do it with loop. it is possible to do it, if is it then please share code with me

string strCheckValue = "";

    if (checkbox1.Checked)

    {

      strCheckValue = "True";

    }

    if (checkbox2.Checked)

    {

      strCheckValue = "True";

    }

........ and so on.

please help...


Update::

i am using sql database. and every check box have a column in database, means that i have 63 check box and in sql database i have also 63 column. i just want that if user checked the check box then the value save "true" in database.

i know i making too much column. please suggest me right ways


Viewing all articles
Browse latest Browse all 2535

Trending Articles