1.11M Members

how to save checkbox in sql DB using asp.net vb

 
0
 

Hello to all

am new programmer facing a problem in saving three checkboxs into database

for example
a
b
c

all of the has a value in the database

any one can heple from scratch

I'll be greatfull

regards,

 
0
 

Such a broad question makes it very difficult to give a good answer.

When you are wanting to store the check boxes, are you checking for yes/no values or something like options a new vehicle?

If you are storing yes/no then it is as simple as storning them in bit/tinyint/boolean fields.

An example for SQL Server (using bit and the OleDB library) would be:

Dim iBitVal As Integer = IIf(CheckBox1.Checked,1,0)
Dim cmdUpdate As New OleDBCommand("UPDATE myTable Set bitColumn1=" & iBitVal & " WHERE UniqueField=MyUniqueValue",MyOleDBConnection)
cmd.Update()

If you are storing something such as options on a new vehicle, you will to design your table accordingly. You can store them all in one field using a max length column or you could create a field for each option (only if constant - Very sloppy but some times manditory)

I hope this helps.

Please provide more infromation for a better answer. :)

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: