Lazarus

Programming => Databases => Topic started by: christophe_D on January 31, 2007, 01:05:59 pm

Title: TDBF and empty field
Post by: christophe_D on January 31, 2007, 01:05:59 pm
hello ,

with this code i have a probleme when a field is empty
i have a error "invalide cast" with a TBDF when Myfield (FtString) is empty
MyEdit is a Tedit

Code: [Select]


procedure Tform1.Myprocedure;


begin
  MyEdit.text:=MyBase.fieldValues['MyFiled'];
[../..]
end;


so for the moment i use this code

Code: [Select]


procedure Tform1.Myprocedure;


begin
  if MyBase.fieldValues['MyFiled']<>'' then MyEdit.text:=MyBase.fieldValues['MyFiled'];
[../..]
end;


is there a solution ??
use a a TDBedit , i can't because MyEdit is not use only with MyBase

thank for your answer
Title: TDBF and empty field
Post by: lazarillo on January 31, 2007, 03:00:19 pm
procedure Tform1.Myprocedure;


begin
  if MyBase.FieldByName('name_field').AsString <>'' then
..................................................

end;
Title: TDBF and empty field
Post by: christophe_D on February 01, 2007, 01:03:05 pm
Quote from: "lazarillo"
procedure Tform1.Myprocedure;


begin
  if MyBase.FieldByName('name_field').AsString <>'' then
..................................................

end;


thanks !!!

i have forget the [.AsString] !!!!
TinyPortal © 2005-2018