Recent

Author Topic: Problems with Result query  (Read 4073 times)

berghem

  • Jr. Member
  • **
  • Posts: 63
Problems with Result query
« on: November 26, 2005, 06:37:02 pm »
Hi, I have this query, when Lazarus executes the query I have the error in the first row, because the result is not Null

if  myQuery['Field'] <> Null then begin
      Result   := Integer(MyQuery['Field']) + 1;
end else begin
         Result   := 1;
end;

Why?

Sorry for my english

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2622
RE: Problems with Result query
« Reply #1 on: November 28, 2005, 02:59:27 pm »
Maybe you can skip the (ugly) variant casting and try the following:

Code: [Select]
Field := myQuery.FieldByName('Field');
if Field.IsNull
then Result := 1
else Result := Field.AsInteger + 1;
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Anonymous

  • Guest
Problems with Result query
« Reply #2 on: November 28, 2005, 05:36:34 pm »
Thank you very much Marc, now ot's all Ok. :D

W Lazarus!!!!

 

TinyPortal © 2005-2018