about checkbox

15 pts.
Tags:
CheckBox
SQL Server
VB.NET
VB.NET 2005
Visual Basic .NET
Iam just at the very basic level of entering a boolean value(yes/no) for the check box cheked value in to a database with field check...for this Iam using a string variable checkvalue and proceeding like this private sub submitbtn_click(.......) dim checkvalue as string="" if checkbox1.checked= true then checkvalue="yes" else if checkbo2.checked=true then checkvalue="no" end if dim strsql as string="insert into table (.....,check)values(........,'" & checkvalue & "')" con.open() dim cmd as sqlcommand(con,strsql) cmd.executenonquery() con.close() end sub but this approach is showing me an syntax error at check which i couldn't find any error in my code... is it the correct programming practice or any thing wrong with my code....plz suggest me the right way to store the checked value into the database regards Anu

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you are trying to put this into a field with a data type of BIT (which would be the database equivalent of boolean) then you have to put in a 0 or a 1. These are the only two values which a field of the BIT data type supports. 0 = No, 1 = Yes.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following