473,474 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

checkboxes in query structure

I have the following in by web form code behind and it says that "operator
'&' is not defined for types 'String' and
'System.Web.UI.WebControls.checkbox'. How do you pass the value of a
checkbox to a query string? The example below was attempting to use a string
variable 'check' and checked1' for values of the checkboxes but with the
variables in the query I get same error but
'System.Web.UI.WebControls.textbox' instead. This insert query eventually
will take info from several check boxes. Thank you.

strsqlInsert2 = "insert into tblinfo (nameID, intakedate,
static99,SignedContract,DateContractSigned,Probati onViolation," & _
"
ProbationViolationDate,PrematureTermination,Termin ationDate,TerminationReason) values (" & intname & ", '" & txtIntakeDate.Text & _
"', '" & txtStatic99.Text & "', '" & checked & "', '" &
txtDateSigned.Text & "', '" & txtProbationViolation & "', '" &
txtDateOfViolation & _
"', '" & checked1 & "', '" & txtTermDate.Text & "', '" &
txtTermReason.Text & ")"

Aug 8 '06 #1
2 1691
CheckBox.Checked.ToString()

"bindurajeesh" <bi**********@discussions.microsoft.comwrote in message
news:66**********************************@microsof t.com...
>I have the following in by web form code behind and it says that "operator
'&' is not defined for types 'String' and
'System.Web.UI.WebControls.checkbox'. How do you pass the value of a
checkbox to a query string? The example below was attempting to use a
string
variable 'check' and checked1' for values of the checkboxes but with the
variables in the query I get same error but
'System.Web.UI.WebControls.textbox' instead. This insert query eventually
will take info from several check boxes. Thank you.

strsqlInsert2 = "insert into tblinfo (nameID, intakedate,
static99,SignedContract,DateContractSigned,Probati onViolation," & _
"
ProbationViolationDate,PrematureTermination,Termin ationDate,TerminationReason)
values (" & intname & ", '" & txtIntakeDate.Text & _
"', '" & txtStatic99.Text & "', '" & checked & "', '" &
txtDateSigned.Text & "', '" & txtProbationViolation & "', '" &
txtDateOfViolation & _
"', '" & checked1 & "', '" & txtTermDate.Text & "', '" &
txtTermReason.Text & ")"

Aug 8 '06 #2
Thanks that did it.

"Greg Young" wrote:
CheckBox.Checked.ToString()

"bindurajeesh" <bi**********@discussions.microsoft.comwrote in message
news:66**********************************@microsof t.com...
I have the following in by web form code behind and it says that "operator
'&' is not defined for types 'String' and
'System.Web.UI.WebControls.checkbox'. How do you pass the value of a
checkbox to a query string? The example below was attempting to use a
string
variable 'check' and checked1' for values of the checkboxes but with the
variables in the query I get same error but
'System.Web.UI.WebControls.textbox' instead. This insert query eventually
will take info from several check boxes. Thank you.

strsqlInsert2 = "insert into tblinfo (nameID, intakedate,
static99,SignedContract,DateContractSigned,Probati onViolation," & _
"
ProbationViolationDate,PrematureTermination,Termin ationDate,TerminationReason)
values (" & intname & ", '" & txtIntakeDate.Text & _
"', '" & txtStatic99.Text & "', '" & checked & "', '" &
txtDateSigned.Text & "', '" & txtProbationViolation & "', '" &
txtDateOfViolation & _
"', '" & checked1 & "', '" & txtTermDate.Text & "', '" &
txtTermReason.Text & ")"


Aug 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mike Lerch | last post by:
I have a database with 90-odd true-false values that I need to display on a webform as checkboxes. There are also some other values (numbers and text) that need to be displayed. I'm wondering...
2
by: dad | last post by:
I need help writing a query to display all boxes that are checked for a particular record. I have ten possible check boxes for each record and each record will have different boxes checked. Any...
2
by: GustavoBrust | last post by:
Hello everyone. I'm having a problem with a search I want to make. It's like this: The user can choose about 15 checkboxes to be his search pattern. According to the combination of...
5
by: ameshkin | last post by:
What I want to do is very simple, but I'm pretty new at PHP and its a little hard for me. I have one page, where there are a rows of checkboxes. A button selects all checkboxes, and then...
2
by: rupes | last post by:
Hi, I am trying to create a SQL selection in ASP where the search terms are defined by the values posted in checkboxes from the form on the previous page. It is used in an email newsletter...
8
by: rch2 | last post by:
Hi, I'm trying to use an update query to update a checkbox field in access 97. In the update query design I am indicating in criteria: =true When I run the update query, a message box...
3
by: mountain.dog | last post by:
I have a query that shows a list of options that a user can toggle on or off using a checkbox. query... form... while($row = mysql_fetch_array($result))... <input name="menu_show_attribute"...
1
by: hmlarson | last post by:
I have a form/table with checkboxes that I would like the user to check / uncheck if they want a certain record to display in a gallery on a website. I'm having problems figuring out how to...
14
by: zufie | last post by:
I have to create a QA report regarding callers calling into a phone hotline. The report consists of many checkboxes such as: Did the IBCCP agency contact you? Yes/NO How many days passed...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.