473,467 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Checkbox into/out of MS SQL as what value?

I am trying to enter the results of a checkbox into an MS SQL table.The
checkbox returns a bool value that I want to place in the database as a bit.
Or is there a better method? I need to read those bits back into the
checkboxes when the database is queried.

Thanks for any help on this.
Harry
Nov 18 '05 #1
4 2179
A bit has two possible values on / off. A boolean has two possible values
true / false.
I think you've found the perfect datatype for storing your value!

Anders Norås
blog: http://dotnetjunkies.com/weblog/anoras

"hari" <mackeyha2athotmaildotcom> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
I am trying to enter the results of a checkbox into an MS SQL table.The
checkbox returns a bool value that I want to place in the database as a
bit. Or is there a better method? I need to read those bits back into the
checkboxes when the database is queried.

Thanks for any help on this.
Harry

Nov 18 '05 #2
Read the bit value from the database and cast it into a bool. Then set the
checkbox value property to that bool value

"hari" wrote:
I am trying to enter the results of a checkbox into an MS SQL table.The
checkbox returns a bool value that I want to place in the database as a bit.
Or is there a better method? I need to read those bits back into the
checkboxes when the database is queried.

Thanks for any help on this.
Harry

Nov 18 '05 #3
IMHO bit is the best way to store boolean value in SQL Server.

in most cases you should be alright.... if you face any problems just use
explicit cast and you should be fine.

--

Regards,

Hermit Dave (D'way)
http://hdave.blogspot.com
"hari" <mackeyha2athotmaildotcom> wrote in message
news:#4**************@TK2MSFTNGP12.phx.gbl...
I am trying to enter the results of a checkbox into an MS SQL table.The
checkbox returns a bool value that I want to place in the database as a bit. Or is there a better method? I need to read those bits back into the
checkboxes when the database is queried.

Thanks for any help on this.
Harry

Nov 18 '05 #4
> checkbox value property to that bool value

That would be the ckeckbox's "checked" attribute.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Tampa .NET Koder" <Ta***********@discussions.microsoft.com> wrote in
message news:7E**********************************@microsof t.com...
Read the bit value from the database and cast it into a bool. Then set the
checkbox value property to that bool value

"hari" wrote:
I am trying to enter the results of a checkbox into an MS SQL table.The
checkbox returns a bool value that I want to place in the database as a bit. Or is there a better method? I need to read those bits back into the
checkboxes when the database is queried.

Thanks for any help on this.
Harry

Nov 18 '05 #5

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

Similar topics

0
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
4
by: Shufen | last post by:
Hi, I'm a newbie that just started to learn python, html and etc. I have some questions to ask and hope that someone can help me on. I'm trying to code a python script (with HTML) to get...
4
by: Bill | last post by:
I have a catalog of books which need to be categorized into different groups. Some of the books can be listed under more than one category. I'm creating a page where I can assign a group of books...
2
by: Fred | last post by:
Hi, I defined a form consisting of checkboxes like: <form> <input type="checkbox" name=ck id=ck onclick="check(this.form)" <input type="checkbox" name=ck id=ck onclick="check(this.form)" ........
4
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input...
6
by: Chuck Anderson | last post by:
My knowledge of JavaScript is limited. I learn from example and then adapt those examples to suit my needs. I have stumped myself on this one. I have a form with checkboxes that I want to...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
11
by: =?Utf-8?B?UGFyYWcgR2Fpa3dhZA==?= | last post by:
Hi All, I have a large recordset to be displayed on a ASP 3.0 page. I am using recordset paging for this. For the next and previous link i am passing href as <a href=<Page URl>?page=<%=...
0
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td...
5
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.