473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Data Type for a CheckBox

I am using a SQL server database and am using a Check Box on my .aspx screen.
What data type should I use when I design my table? I tried bit but When I
ran the program and Checked one of the check boxes I got a msg: True is not a
valid value for int16. I changed the data type to small int, re-ran the
program, checked the box and got: Entered value cannot be converted to int16.
Nov 17 '05 #1
5 7947
you can check the condition/state of checkbox and then send value from your
side e.g. 1 for true and 0 or false.
"BigAl" <Bi***@discussions.microsoft.com> wrote in message
news:C0**********************************@microsof t.com...
I am using a SQL server database and am using a Check Box on my .aspx
screen.
What data type should I use when I design my table? I tried bit but When
I
ran the program and Checked one of the check boxes I got a msg: True is
not a
valid value for int16. I changed the data type to small int, re-ran the
program, checked the box and got: Entered value cannot be converted to
int16.

Nov 17 '05 #2


"BigAl" wrote:
I am using a SQL server database and am using a Check Box on my .aspx screen.
What data type should I use when I design my table? I tried bit but When I
ran the program and Checked one of the check boxes I got a msg: True is not a
valid value for int16. I changed the data type to small int, re-ran the
program, checked the box and got: Entered value cannot be converted to int16.


Thanks for the quick response, however, what data type should I use in my
Sql Server database? Also, I use a dataset/dataview for fetches and updates.
When I check the checkbox will the dataset be automatically updated?
Nov 17 '05 #3
Hi,

You should use bit:

//Store in the DB
com.Parameters.Add("@internalDOTReq", SqlDbType.Bit).Value =
this.internaldotrequest?1:0;

//retrieve from DB
bool internaldotrequest = (bool)reader["internalDOTReq"];
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"BigAl" <Bi***@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com...


"BigAl" wrote:
I am using a SQL server database and am using a Check Box on my .aspx
screen.
What data type should I use when I design my table? I tried bit but When
I
ran the program and Checked one of the check boxes I got a msg: True is
not a
valid value for int16. I changed the data type to small int, re-ran the
program, checked the box and got: Entered value cannot be converted to
int16.


Thanks for the quick response, however, what data type should I use in my
Sql Server database? Also, I use a dataset/dataview for fetches and
updates.
When I check the checkbox will the dataset be automatically updated?

Nov 17 '05 #4
"BigAl" <Bi***@discussions.microsoft.com> schrieb im Newsbeitrag
news:C0**********************************@microsof t.com...
I am using a SQL server database and am using a Check Box on my .aspx
screen.
What data type should I use when I design my table? I tried bit but When
I
ran the program and Checked one of the check boxes I got a msg: True is
not a
valid value for int16. I changed the data type to small int, re-ran the
program, checked the box and got: Entered value cannot be converted to
int16.


Hi BigAl,

it shuold work with datatype bit in SQL Server and Boolean in the DataSet!!
Hope that helps
Nov 17 '05 #5


"Christof Nordiek" wrote:
"BigAl" <Bi***@discussions.microsoft.com> schrieb im Newsbeitrag
news:C0**********************************@microsof t.com...
I am using a SQL server database and am using a Check Box on my .aspx
screen.
What data type should I use when I design my table? I tried bit but When
I
ran the program and Checked one of the check boxes I got a msg: True is
not a
valid value for int16. I changed the data type to small int, re-ran the
program, checked the box and got: Entered value cannot be converted to
int16.


Hi BigAl,

it shuold work with datatype bit in SQL Server and Boolean in the DataSet!!
Hope that helps

Thanks...As it turned out, I was doing everything right but had other
issues...stuff that drives programmers crazy. I was mixing controls from dev
express and asp.net and using a dev express datacontroller. aspx.net
controls don't mix well with a dev express datacontroller.
Nov 17 '05 #6

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

Similar topics

7
by: Old Lady | last post by:
Hi all, I have a problem when I try to send an array using a form when the type="checkbox". This is my form input row: <INPUT type="Checkbox" name="flg" value="y" <? if($row == 'y') echo...
21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
13
by: Peter | last post by:
Can anyone tell me how to change the data type of a field in a table created with a make table query? The field is a binary and must be changed to text. alternately does anyone know how to specify...
0
by: Alex | last post by:
I found some good information On "Including a Data Bound CheckBox in an Editable DataGrid... " at this site http://www.dedicatedsolutions.co.uk/DesktopDefault.aspx?tabid=62 It is worth the click
1
by: Neo | last post by:
I have a field named "Male" & this is of SQL BIT data type (SQL Server). How can i bind this field to a check box? I noticed that this field can be NULL, 0 or 1. But i'm having trouble binding...
2
by: Neo | last post by:
I put a similar post for CheckBoxes, but i want to use a Radio button & not a CheckBox I have a field named "Male" & this is of SQL BIT data type (SQL Server). How can i bind this field to a...
13
by: Fei Liu | last post by:
Hi Group, I've got a problem I couldn't find a good solution. I am working with scientific data files in netCDF format. One of the properties of netCDF data is that the actual type of data is only...
1
by: mke1981 | last post by:
Please someone help, i have been playing with the line of code for two days and still not getting anywhere. I have a checkbox on my form called Chkrugby when this is clicked and saved to the sql...
9
by: nixonmg | last post by:
When the Command Button "Notify" is clicked, I am wanting to send out an email to the user with appropriate information in the email (works great), check the "Notified" check box (does not work), and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.