[Mono-list] Cast a char(1) to a boolean

Sijmen Mulder Sijmen Mulder <sjmulder@gmail.com>
Sat, 23 Oct 2004 07:22:35 +0200


Hi,

> I was told to use a char(1) in a MySQL database since it doesn't have a
> boolean type.  I retrieve a char(1) field but I can't seem to cast it to
> be a boolean.  How is this done?

try:

bool thebool = (int)thechar==0 ? false : true;

-- 

 'May the Lord bless you and protect you. May the Lord smile on you
and be gracious to you. May the Lord show you his favor and give you
his peace.'
 'De Heer zegent je, en Hij bewaart je. De Heer kijkt met liefde naar
je, en Hij is je genadig. De Heer bedenkt het goede voor je, en geeft
je vrede.'

Sijmen Mulder