delphi -------------------------- declare @tb table (id int) insert into @tb select 1 insert into @tb select 2 insert into @tb select 0 insert into @tb select 0 insert into @tb select 5 select case when id=0 then null else id end from @tb
哦 那你先在数据源把关系做好呀 如 select 字段1...........,case when mount=0 then null else mount end as mount1 from 表1,表2....... 你按着这个思路做吧 最好 在dbgrid 中用个数据源就行了,记录 现在字段不是mount 而是mount1 当为零时就不显示了 这是我刚测试的 通过的 你改下表名 字段试下吧 放到查询adoquery1 with adoquery1 do begin close; sql.clear; sql.text='下面那段放到这里就行了'; open; end; select a.yaoid,a.mount,a.ph, case when a.xsdj1=0 then null else a.xsdj1 end as xsdj from cgstore a
不过用过滤也行,这就是不显示为0的了
with adomain1 do
begin
Filtered:=false;
Filter:= 'mount<>'+'0';
Filtered:=true;
end;
--------------------------
declare @tb table (id int)
insert into @tb select 1
insert into @tb select 2
insert into @tb select 0
insert into @tb select 0
insert into @tb select 5
select case when id=0 then null else id end from @tb
select 字段1...........,case when mount=0 then null else mount end as mount1 from 表1,表2.......
你按着这个思路做吧
最好 在dbgrid 中用个数据源就行了,记录 现在字段不是mount 而是mount1 当为零时就不显示了
这是我刚测试的 通过的 你改下表名 字段试下吧 放到查询adoquery1
with adoquery1 do
begin
close;
sql.clear;
sql.text='下面那段放到这里就行了';
open;
end;
select a.yaoid,a.mount,a.ph,
case when a.xsdj1=0 then null else a.xsdj1 end as xsdj
from cgstore a