表:TB 
字段 :设备1,数量1,设备2,数量2,设备3,数量3设备20,数量20
设备字段类型为“文本”,数量字段类型“长整型”。实现功能,通过查询,返回非空的记录,并显示在DBGrid,即,字段内容为空的或字段内容为 0 的字段不显示在DBGrid.
麻烦各位兄弟帮忙。

解决方案 »

  1.   

    select ... from TB where 设备n <> '' and 设备n is not null and 数量n <> 0 and 数量n is not null
      

  2.   

    楼上SELECT 语句不行啊。我的意思是,只要是空的或者为0的字段不返回。
    比如:第一条记录,设备1,数量1,设备2,数量2 非空非0,而设备3,数量3设备20,数量20都非空非0。
        第二条记录,设备1,数量1,设备2,数量2 为空为0,而设备3,数量3设备20,数量20都为空为0。
        第三记录,
        第四条记录  。。筛选之后显示在DBGrid.
      

  3.   

    select ... from TB where isnull(设备n,'')<>'' and isnull(数量n,0)<>0
      

  4.   

    select ... from 表名 where 設備n <> '' and 設備n is not null and 數量n <> 0 and 數量n is not null
      

  5.   

    先select * from tab
    再用个循环判断。。