如何打印不为零的字段名
有一张表有N个字段,现在只想打印不为零的字段名.(有数据的字段名打印,无数据的字段名就不打印出来,效果是让人看见:a1,a2,a4,a5)
表2.rar
(497 Bytes)
[ 本帖最后由 tjdeming 于 2013-6-6 01:52 编辑 ]
CLOSE DATABASES USE D:\1\表2 IN 0 SELECT 表2 sql_c='' FOR i=1 TO FCOUNT() LOCATE FOR NOT EMPTY(EVALUATE(FIELD(i))) IF FOUND() sql_c=sql_c+ALLTRIM(FIELD(i))+"," ENDIF ENDFOR IF NOT EMPTY(sql_c) *sql_c="select "+LEFT(sql_c,LEN(sql_c)-1)+" from 表2 where 序号=1001 into cursor 表2_tmp" sql_c="select recno() 序号,* from (select "+LEFT(sql_c,LEN(sql_c)-1)+" from 表2 where 序号=1001 ) a into cursor 表2_tmp" &sql_c SELECT 表2_tmp m.out_filename=ALLTRIM(PUTFILE('','','xls')) IF not empty(m.out_filename) SELECT 表2_tmp COPY to (m.out_filename) XLS &&导出excel ENDIF USE IN 表2_tmp ENDIF CLOSE DATABASES在 &sql_c 语句卡住了不能运行下去了. 用的是VFP6.0