Friday, February 24, 2012

Data Types

I'm creating a windows .net form that has SQL as the back-end. One of the
controls is a group box with three radio buttons options. What data type
should this column have, so whatever option the user chooses will be saved o
n
the SQL table?
Another one, a YES/NO field, what data type should this column have?
--
TSHi TS,
You can use a numeric field and store 1 or 0.
please let me know if u have any questions.
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.SQLResource.com/
---
"TS" wrote:

> I'm creating a windows .net form that has SQL as the back-end. One of the
> controls is a group box with three radio buttons options. What data type
> should this column have, so whatever option the user chooses will be saved
on
> the SQL table?
> Another one, a YES/NO field, what data type should this column have?
> --
> TS|||With three radio buttons you either have three or four options - if you allo
w
none of the options to be selected (maybe as an initial state).
E.g.
null - none selected
0 - first selected
1 - second selected
2 - third selected
etc.
I believe TINYINT could cover that. Look it up in Books Online if you
haven't already.
However, a more humanly-readable aproach would be to use more descriptive
values - make use of enumerations in .Net and map them to a table in your
database if appropriate. After all - this is the 21st century. ;)
ML|||On Thu, 27 Oct 2005 08:26:13 -0700, TS wrote:

>I'm creating a windows .net form that has SQL as the back-end. One of the
>controls is a group box with three radio buttons options. What data type
>should this column have, so whatever option the user chooses will be saved
on
>the SQL table?
>Another one, a YES/NO field, what data type should this column have?
Hi TS,
You're approaching this from the wrong side.
You should first investigate what data is needed for the application
that you are creating. Identify the dependencies and the business rules,
then normalize the data to at least third normal form and create your
tables.
Once that is done, the next step is to create a GUI that makes it as
easy as possible for the user to enter the required data into the
system. For a column where only a few specific options are legal, a
group box with radio buttons might be fine (but so might a textbox with
dropdown). For a column with only two legal values, a yes/no button
might be appropriate (but a checkbox, a dropdown, or a set of two radio
buttons might do as well).
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

No comments:

Post a Comment