主从表中的从表中的一字断值判断是否其中有一值=0现有表q1,q2(从表) nums(q2的一数字字段)if q2nums.value=0 then
....
end
这一句只能判断当前选中的dbgrid2(q2)的值,我要得到只要dbgrid2(q2)内有一
值=0 则 showmessage('有值为空')
....
end
这一句只能判断当前选中的dbgrid2(q2)的值,我要得到只要dbgrid2(q2)内有一
值=0 则 showmessage('有值为空')
调试欢乐多
Select count(*) As cnt
From yourTable_Q2
Where nums=0判断count(*)的結果(cnt)是否為0
with adoquery1 do
begin
sql.add('select q1.*,q2.nums from q1,q2 where q1.条件=q2.条件');
active:=true;
end;
if adoquery1.fieldbyname('nums').asfloat=0 then
....
end不知是不是这个意思
begin
close;
sql.clear;
sql.add('select * from q2 where q2.nums=0');
open;
end;if AdoQuery1.count>0 then
showmessage('有值为空');
begin
Filter := 'nums=0';
Filtered := true;
if RecordCount>0 then showmessage('有值为空');
end;(注:在不改変SQL文内容的状況下、還可用過濾器的方法)