如何判断查询空值?
各位大虾,我在写一个语句的时候很郁闷啊,可能很弱智,大家帮帮忙啊~~
语句是这样写的:
with qry do
begin
close;
sql.clear;
sql.add('select sum(amount) from CosttempTable');//amount是Costtemptable表中的一个字段,money型的
open;
end;
因为引发这个查询的是一个Click事件,而有时候这个临时表里是没有数据的,
我定义了一个total,整形的,然后写
if qry.Fieldvalues['SUM'] = '' then total := 0;
total := qry.Fieldvalues['SUM'];
然后我就用inttostr(total)把数值转换为STRING输出,却总是在当临时表里没有数据时出错,说不能将空类型转为STRING,帮帮忙啊!小弟第一次用DELPHI,以前一直用C的