Recent

Author Topic: TDBF and empty field  (Read 3297 times)

christophe_D

  • New Member
  • *
  • Posts: 20
TDBF and empty field
« 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

lazarillo

  • Guest
TDBF and empty field
« Reply #1 on: January 31, 2007, 03:00:19 pm »
procedure Tform1.Myprocedure;


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

end;

christophe_D

  • New Member
  • *
  • Posts: 20
TDBF and empty field
« Reply #2 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