Forum > Databases
Problems with Result query
(1/1)
berghem:
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:
Maybe you can skip the (ugly) variant casting and try the following:
--- Code: ---Field := myQuery.FieldByName('Field');
if Field.IsNull
then Result := 1
else Result := Field.AsInteger + 1;
--- End code ---
Anonymous:
Thank you very much Marc, now ot's all Ok. :D
W Lazarus!!!!
Navigation
[0] Message Index