Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 27th, 2005, 12:19 PM
Registered User
 
Join Date: Mar 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do I send boolean values with a checkbox

Please Help me. I guess it is simple, but not for me
I wish to use a checkbox to send two values :
value 1 if checked, and value 0 if unchecked
At the moment it sends the correct boolean value when the box is checked
But NOT when it is unchecked.
In that later case, the Update SQL sentence returns an error message saying
Incorrect syntax near the word WHERE
(Instead of UPDATE table1 SET oven=0 WHERE .....)

By the way, I wish to use boolean values in that column because I need to link it with another table, and that join does not respond to "Null" values.

Thank you in advance for you answer if you can, and happy Easter

 
Old March 28th, 2005, 12:01 AM
Registered User
 
Join Date: Mar 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

what is ur database???
did u check if that 1 or 0 value cud be inserted into the database ???
if it takes only true or false value then sending of numberic value might have caused this error

The following example displays "True" or "False" in a Label Web server control to reflect the latest change in a CheckBox control.
' Visual Basic
Private Sub CheckBox1_CheckedChanged(ByVal sender As _
   System.Object, ByVal e As System.EventArgs) Handles _
   CheckBox1.CheckedChanged
   Label1.Text = "CheckBox1 selection is: " & CheckBox1.Checked
End Sub

// C#
private void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
   Label1.Text = "CheckBox1 selection is: " + CheckBox1.Checked;
}

the above is fr msdn

hope it helps



 
Old March 28th, 2005, 05:43 AM
Registered User
 
Join Date: Mar 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks,
My data base is SQL, and i can insert 0 or 1 values
I looked at the private Sub checkBox you propose. However, I am too much of a beginner to use it yet. I have to learn it first.
So I finaly decided to turn the problem around and create a link "many to one" on the database, so that, even if I have a null value, it should give an answer.
Thanks any ways.
:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Save Checkbox with boolean 0/1 value rdove84 ASP.NET 1.0 and 1.1 Basics 5 October 24th, 2006 09:12 AM
Updating boolean values using datalist Scripts82 ASP.NET 1.0 and 1.1 Basics 1 September 20th, 2006 04:17 AM
Displaying Boolean Values from Datagrid rstelma ASP.NET 1.0 and 1.1 Professional 10 January 9th, 2006 01:48 AM
Checkbox values HELP! vkwebcommander Classic ASP Databases 2 January 18th, 2005 09:29 AM
checkbox values zaman1111 Javascript 2 September 22nd, 2004 04:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.