[DUG] TDBCheckbox
Dave O'Brien
dave at ICCS.CO.NZ
Tue Nov 24 09:19:35 NZDT 2009
I assume you have checked with a trace that Pump is ever true?
I would recommend checking for eof before trying to assign to the db
field.
PSQLQuery2.Open;
If not PSQLQuery.eof then
begin
Pump:= PSQLQuery2.FieldByName('pump1').AsBoolean ;
DBCheckbox6.Enabled := Pump ;
end;
Or
PSQLQuery2.Open;
If not PSQLQuery.eof then
DBCheckbox6.Enabled := PSQLQuery2.FieldByName('pump1').AsBoolean
;
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of Bob Pawley
Sent: Tuesday, 24 November 2009 8:01 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] TDBCheckbox
Hi
I have two tdbcheckboxes.
I want one checkbox to be disabled unless the other checkbox is checked.
The following does compile but DBCheckbox6 isn't enebled when the sql
condition is true.
Could someone suggest what it is I am doing wrong??
Bob
begin
DBCheckbox6.Enabled := False;
begin
PSQLQuery2.Close;
PSQLQuery2.SQL.Clear;
PSQLQuery2.SQL.Add ('select (p_id.processes.pump1)');
PSQLQuery2.SQL.Add ('from p_id.processes');
PSQLQuery2.SQL.Add ('where p_id.processes.fluid_id = :Fluidid');
PSQLQuery2.ParamByName('Fluidid').AsString := DBEdit2.Text;
PSQLQuery2.Prepare;
PSQLQuery2.Open;
PSQLQuery2.First ;
Pump:= PSQLQuery2.FieldByName('pump1').AsBoolean ;
If
Pump = True
then
DBCheckbox6.Enabled := True;
end;
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20091124/a87b8c4f/attachment.html
More information about the Delphi
mailing list