图片附件: 游客没有浏览图片的权限,请
登录 或
注册
** test.prg
CREATE CURSOR tt (f1 I, f2 I, f3 I)
FOR i=1 TO 100
INSERT INTO tt VALUES (i, i*2, i*3)
ENDFOR
of = CREATEOBJECT("form1")
of.show(1)
DEFINE CLASS form1 as Form
ADD OBJECT check1 as checkbox WITH top=10,left=10,width=50,caption="f1"
ADD OBJECT check2 as checkbox WITH top=10,left=60,width=50,caption="f2"
ADD OBJECT check3 as checkbox WITH top=10,left=110,width=50,caption="f3"
ADD OBJECT cmd1 as commandbutton WITH top=10,left=160,caption="查询"
ADD OBJECT grid1 as grid WITH top=40,left=10,recordsourcetype=4,;
recordsource="SELECT * FROM tt INTO CURSOR tt_tmp"
PROCEDURE cmd1.click
LOCAL rs
rs = ""
IF thisform.check1.value==1
rs = rs + thisform.check1.caption + ","
ENDIF
IF thisform.check2.value==1
rs = rs + thisform.check2.caption + ","
ENDIF
IF thisform.check3.value==1
rs = rs + thisform.check3.caption + ","
ENDIF
rs = IIF(EMPTY(rs), "*", RTRIM(rs,","))
rs = "SELECT " + rs + " FROM tt INTO CURSOR tt_tmp"
thisform.grid1.recordsource = rs
ENDPROC
ENDDEFINE