Re: Simple Question - I Think:/
From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 04/22/04
- Next message: William Ryan eMVP: "Re: Maintenence Management Professional"
- Previous message: Micheal: "Re: SQL Parameters Question"
- In reply to: MadCrazyNewbie: "Simple Question - I Think:/"
- Next in thread: Cor Ligthert: "Re: Simple Question - I Think:/"
- Reply: Cor Ligthert: "Re: Simple Question - I Think:/"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 22 Apr 2004 09:59:41 -0400
MadCrasyNewbie:
Like Deepak mentioned, you can set the field as a bit and therefore make it
an either/or scenario. If you bind it to a grid, then it will automatically
come in as a CheckBox for instance. 0 and 1 map to True and false in text
so databinding it to that field will get you the result. Remember though
that binding to this field is going to give you a SelectedValue or True
and/or False not 0 or 1. Moreover, if you check the type, you'll get
System.Boolean. When I did this a while back, I set the ValueMember to the
Bit field and I expected the Display to be true or false but the Actual
value to be 0 or 1. That's not the case, it's true or false for both.
This will still update like you expect though, so it's not really a problem
although I thought it might be when I first discovered it.
The bottom line, Deepak provided a complete and correct answer. When I was
learning this, I often thought too hard about stuff worrying about things
that didn't matter. In fact it all makes perfect sense now but I figured
I'd mention it in case anyone else suffers from the same problem ;-)
However, for a combo box and true and false,
"MadCrazyNewbie" <test@nospam.com> wrote in message
news:aR6cnX86D9BF6RrdSa8jmA@karoo.co.uk...
> Hey Group,
>
> A Really Simple one, I have a feild in my Database which I would like a
YES
> or a NO on, how would i setup my ComboBox to allow this, and for it to
> update my DB?
>
> Many Thanks
> MCN
>
>
- Next message: William Ryan eMVP: "Re: Maintenence Management Professional"
- Previous message: Micheal: "Re: SQL Parameters Question"
- In reply to: MadCrazyNewbie: "Simple Question - I Think:/"
- Next in thread: Cor Ligthert: "Re: Simple Question - I Think:/"
- Reply: Cor Ligthert: "Re: Simple Question - I Think:/"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|