*如果用16楼的,自己先把字段名称用 CheckBox 列出来,选择后,在查询,那就简单多了
* 在 thisform.init
CREATE CURSOR 成绩(学号 c(6),语文 n(5,2),数学 n(5,2),英语 n(5,2),物理 n(5,2),生物 n(5,2))
INSERT INTO 成绩 VALUES ("1001",95.5,85,95,84,89)
INSERT INTO 成绩 VALUES ("1002",93.5,85,95,84,89)
INSERT INTO 成绩 VALUES ("1003",97.5,85,95,84,89)
thisform.grid1.ColumnCount = -1
thisform.grid1.RecordSourceType = 1
thisform.grid1.RecordSource = "成绩"
* 分别建立6个CheckBox,名称分别是 check1,check2,check3,check4,check5,check6,代表(语文,数学,英语,物理,生物)
* 建立1个按钮,command1.click
LOCAL cSql
cSql="select 学号"
IF thisform.check1.Value = 1
cSql = cSql + "," + thisform.check1.Caption
ENDIF
IF thisform.check2.Value = 1
cSql = cSql + "," + thisform.check2.Caption
ENDIF
IF thisform.check3.Value = 1
cSql = cSql + "," + thisform.check3.Caption
ENDIF
IF thisform.check4.Value = 1
cSql = cSql + "," + thisform.check4.Caption
ENDIF
IF thisform.check5.Value = 1
cSql = cSql + "," + thisform.check5.Caption
ENDIF
cSql = cSql + " from 成绩 into cursor tmp_成绩 readwrite"
EXECSCRIPT(cSql)
thisform.grid1.ColumnCount = -1
thisform.grid1.RecordSourceType = 1
thisform.grid1.RecordSource = "tmp_成绩"
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
[此贴子已经被作者于2018-6-7 16:58编辑过]