Click here to Skip to main content
15,910,603 members
Home / Discussions / C#
   

C#

 
GeneralRe: Store multiple checkbox values in a single field in database Pin
Pete O'Hanlon5-Aug-09 22:44
mvePete O'Hanlon5-Aug-09 22:44 
GeneralRe: Store multiple checkbox values in a single field in database Pin
Mycroft Holmes5-Aug-09 23:19
professionalMycroft Holmes5-Aug-09 23:19 
GeneralRe: Store multiple checkbox values in a single field in database Pin
Pete O'Hanlon6-Aug-09 0:28
mvePete O'Hanlon6-Aug-09 0:28 
AnswerRe: Store multiple checkbox values in a single field in database Pin
JollyMansArt5-Aug-09 21:14
JollyMansArt5-Aug-09 21:14 
GeneralRe: Store multiple checkbox values in a single field in database Pin
Greg Chelstowski5-Aug-09 21:19
Greg Chelstowski5-Aug-09 21:19 
GeneralRe: Store multiple checkbox values in a single field in database Pin
JollyMansArt5-Aug-09 21:23
JollyMansArt5-Aug-09 21:23 
GeneralRe: Store multiple checkbox values in a single field in database Pin
Mycroft Holmes5-Aug-09 21:20
professionalMycroft Holmes5-Aug-09 21:20 
AnswerRe: Store multiple checkbox values in a single field in database Pin
Greg Chelstowski5-Aug-09 21:18
Greg Chelstowski5-Aug-09 21:18 
Provided, your checkboxlist always looks the same, i.e. it has the same number of checkboxes and they are indexed the same way, if you use a varchar field to store a string of numbers, something like "101100101",
you can then use a stringbuilder to create your string iterating through the collection of your checkboxes.
If the checkbox is checked, set the value to one and zero if it's unchecked.

I do agree that this is not the greatest of designs, but it might just make do.

Another way to do it would be to use an Xml field (provided your using Sql Server), and store the values in there.

var question = (_2b || !(_2b));

AnswerRe: Store multiple checkbox values in a single field in database Pin
Adam Jasper5-Aug-09 23:49
Adam Jasper5-Aug-09 23:49 
GeneralRe: Store multiple checkbox values in a single field in database Pin
elci6-Aug-09 0:12
elci6-Aug-09 0:12 
QuestionNeed help retreiving the image from the database... Pin
JollyMansArt5-Aug-09 20:53
JollyMansArt5-Aug-09 20:53 
AnswerRe: Need help retreiving the image from the database... Pin
Henry Minute6-Aug-09 2:46
Henry Minute6-Aug-09 2:46 
QuestionCrystal Report Formula Pin
mjawadkhatri5-Aug-09 19:25
mjawadkhatri5-Aug-09 19:25 
AnswerRe: Crystal Report Formula Pin
JollyMansArt5-Aug-09 19:36
JollyMansArt5-Aug-09 19:36 
GeneralRe: Crystal Report Formula Pin
mjawadkhatri5-Aug-09 22:23
mjawadkhatri5-Aug-09 22:23 
GeneralVoice file conversion Pin
Pandu4385-Aug-09 18:28
Pandu4385-Aug-09 18:28 
QuestionDelimeters to split strings Pin
gamer11275-Aug-09 18:19
gamer11275-Aug-09 18:19 
AnswerRe: Delimeters to split strings Pin
dan!sh 5-Aug-09 18:27
professional dan!sh 5-Aug-09 18:27 
GeneralRe: Delimeters to split strings Pin
gamer11276-Aug-09 0:11
gamer11276-Aug-09 0:11 
AnswerRe: Delimeters to split strings Pin
Luc Pattyn5-Aug-09 23:50
sitebuilderLuc Pattyn5-Aug-09 23:50 
GeneralRe: Delimeters to split strings Pin
gamer11276-Aug-09 0:47
gamer11276-Aug-09 0:47 
GeneralRe: Delimeters to split strings Pin
Luc Pattyn6-Aug-09 0:53
sitebuilderLuc Pattyn6-Aug-09 0:53 
GeneralRe: Delimeters to split strings Pin
gamer11276-Aug-09 1:07
gamer11276-Aug-09 1:07 
AnswerRe: Delimeters to split strings Pin
Luc Pattyn6-Aug-09 1:14
sitebuilderLuc Pattyn6-Aug-09 1:14 
GeneralRe: Delimeters to split strings Pin
gamer11276-Aug-09 1:31
gamer11276-Aug-09 1:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.