BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Boolean still not working?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express)
View previous topic :: View next topic  
Author Message
Patrick Moloney
Guest





PostPosted: Tue Mar 13, 2007 9:21 pm    Post subject: Boolean still not working? Reply with quote



I'm using IB 7.5, Delphi 7 with IBX (hence here I am).
I have a Checkbox on my form and a boolean column in my database.
I'm using a stored procedure and a IB stored proc component.
I'd like to say:
ParamByName('MyParameter').AsBoolean := Mycheckbox.Checked;
This looks like it is passing a -1 when checked and 0 when unchecked.
I get Sql error from IB for bad value or overflow. I think it wants 0
or 1.
Only fails when checked and passing -1.

My application includes other boolean work-arounds from previous
version, but I thought this might work by now. Has this never been
fixed?


--
Patrick Moloney
Back to top
Patrick Moloney
Guest





PostPosted: Wed Mar 14, 2007 2:38 am    Post subject: Re: Boolean still not working? Reply with quote



Further time invested indicates this is not an IBX problem, but a
Delphi component problem. There are multiple entries in QC describing
various incarnations of the problem. However, IBX and the Delphi
components appear incompatible as far as Boolean is concerned.

The Delphi components (TCheckbox in this case) generate -1 for True and
0 for False. IBX and IB expect +1 and 0, producing the SQL exception.
Some explanations that this is C-code heritage for these components.

I have again resorted to:
If MyCheckbox.Checked Then
mySP.ParambyName('PXX').AsInteger = 1
Else
mySP.ParambyName('Pxx').AsInteger = 0;
(This parameter being Boolean).


--
Patrick Moloney
Back to top
Moore
Guest





PostPosted: Thu Mar 15, 2007 8:13 pm    Post subject: Re: Boolean still not working? Reply with quote



Doesn´t TDBCheckBox have a ValueChecked ValueUnchecked properties???

Patrick Moloney escribió:
Quote:
The Delphi components (TCheckbox in this case) generate -1 for True and
0 for False. IBX and IB expect +1 and 0, producing the SQL exception.
Some explanations that this is C-code heritage for these components.
Back to top
Patrick Moloney
Guest





PostPosted: Thu Mar 15, 2007 10:36 pm    Post subject: Re: Boolean still not working? Reply with quote

Moore wrote:

Quote:
Doesn´t TDBCheckBox have a ValueChecked ValueUnchecked properties???


I don't know either. I'm not using the TDB.. components.


--
Patrick Moloney
Back to top
Moore
Guest





PostPosted: Fri Mar 16, 2007 6:10 pm    Post subject: Re: Boolean still not working? Reply with quote

So use them..
Patrick Moloney escribió:
> I don't know either. I'm not using the TDB.. components.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.