vf中怎么组合框中引用数据库中的表的字段

vf中怎么组合框中引用数据库中的表的字段,第1张

1、组合框点右键-生成器,选择“手工输入数据”,然后依次输入你需要显示的字段名。

2、文本框和表格控件添加进来。

3、在按钮上加上代码:

sele 表名 &&表要先加到数据环境中

c1=alltrim(thisform.combo1.value)

t1=thisform.text1.value &&如果是字符型最好加上alltrim()函数

loca for &c1=t1

if found()

sele * from 表名 where &c1=t1 into cursor "temp"

thisform.grid1.recordsource="temp"

else

messagebox("未找到符合条件的记录!",64,"查询失败")

endif

数据环境添加department,组合框的rowsourcetype选别名,controlsource填department.系名称,组合框的valiud事件这样写:

thisform.grid1.recordsource="Select student.学号,studengt.姓名,department.系名称,score.总分 From student join (score On student.学号=score.学号 ) and (department on student.系别号=department.系别号)where allt(department.系名称)=allt(this.value)Into cursor bg "

表格的recordsourcetype选sql,recordsource填

thisform.grid1.recordsource="Select student.学号,studengt.姓名,department.系名称,score.总分 From student join (score On student.学号=score.学号 ) and (department on student.系别号=department.系别号)where allt(department.系名称)=allt(this.value)Into cursor bg "

SELECT 学号 DISTINCT FROM 分数

INTO CURSOR temp

select temp

DO WHILE NOT EOF()

THISFORM.combol.ADDITEM(temp.学号) &&THISFORM.combo1.ADDITEM(temp.学号)

SKIP

ENDDO

1和字母l是不一样的

看仔细了


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/8028774.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-12
下一篇 2023-04-12

发表评论

登录后才能评论

评论列表(0条)

保存