4.8 组合查询窗体的设计 内容来自论文无忧网 www.paper51.com
应不同用户的需求单单的简单查询是远远不够的,在此我设计了一个通过数据窗口控件动态的随用户需求而生成sql语句,来完成组合查询的目的。并且在其中可将查询到的记录保存成txt文件,以便于编辑使用,这可以完成十分强大的查询功能。是本次开发我自己的满意之处。下面是组合查询的界面设计。 http://www.paper51.com paper51.com 该功能实现的“开始统计”按钮的代码如下: 内容来自论文无忧网 www.paper51.com stringls_xb,ls_zhi,ls_fh,ls_yu,aaa,ls_csny paper51.com dateld_jzsj,ld_gzny,ld_xb 内容来自www.paper51.com intll_rows,a,b,i paper51.com ll_rows=dw_1.rowcount() paper51.com ifll_rows>0 then paper51.com a=long(ll_rows) 内容来自www.paper51.com
ls_xb=trim(dw_1.object.data[1,1]) 内容来自论文无忧网 www.paper51.com ls_fh=trim(dw_1.object.data[1,2]) copyright paper51.com ls_zhi=trim(dw_1.object.data[1,3]) 内容来自www.paper51.com aaa="string("+trim(ls_xb)+")"+trim(ls_fh)+"'"+trim(ls_zhi)+"'" paper51.com if string(ls_xb)='csny'orstring(ls_xb)='jzsj' or string(ls_xb)='gzsj'then 内容来自论文无忧网 www.paper51.com aaa=""+ls_xb+""+trim(ls_fh)+""+ls_zhi+"" http://www.paper51.com
endif http://www.paper51.com ifll_rows=1 then copyright paper51.com dw_2.setfilter(""+aaa+"") copyright paper51.com dw_2.filter() copyright paper51.com dw_2.settrans(sqlca) copyright paper51.com dw_2.retrieve() paper51.com else 内容来自论文无忧网 www.paper51.com for i=2 to a copyright paper51.com
ls_xb=trim(dw_1.object.data[i,1]) 内容来自论文无忧网 www.paper51.com ls_fh=trim(dw_1.object.data[i,2]) 内容来自论文无忧网 www.paper51.com ls_zhi=trim(dw_1.object.data[i,3]) http://www.paper51.com b=i - 1 copyright paper51.com ls_yu=trim(dw_1.object.data[b,4]) copyright paper51.com if string(ls_xb)='csny'orstring(ls_xb)='jzsj' or string(ls_xb)='gzsj'then copyright paper51.com aaa=(""+aaa+"")+" "+trim(ls_yu)+" "+""+ls_xb+""+trim(ls_fh)+""+ls_zhi+"" 内容来自论文无忧网 www.paper51.com else copyright paper51.com aaa=(""+aaa+"")+" "+trim(ls_yu)+" "+"string("+trim(ls_xb)+")"+trim(ls_fh)+"'"+trim(ls_zhi)+"'" copyright paper51.com
endif 内容来自论文无忧网 www.paper51.com endfor http://www.paper51.com i=i+1 http://www.paper51.com dw_2.setfilter(""+aaa+"") http://www.paper51.com dw_2.filter() copyright paper51.com dw_2.settrans(sqlca) copyright paper51.com dw_2.retrieve() http://www.paper51.com endif 内容来自论文无忧网 www.paper51.com else http://www.paper51.com messagebox("错误提示","请点击增加查询条件!") 内容来自www.paper51.com endif http://www.paper51.com
intll_row copyright paper51.com ll_row=dw_2.rowcount() http://www.paper51.com ifll_row=0 then http://www.paper51.com messagebox("提示窗口","没有符合条件的记录!") paper51.com endif 内容来自论文无忧网 www.paper51.com 4.9 学生成绩的录入窗体设计 paper51.com 在学生的成绩录入过程中,有的课程信息、班名、选修方向是相同的,为了避免大量的信息的重复性的录入问题。在这里使用了下拉列表,其中列表中的信息是从方向班级库、课程库、来动态添加的,也可以直接填写,从而大大的方便了用户,节省了时间。而学生的基本信息是通过游标来实现的,避免了将未注册的学生填进来,实现了数据的完整性。在设计中其他部分也应用到了游标,就不一一介绍。这也是本人开发的满意之处。下面是设计过程中的游标使用的部分代码: 内容来自www.paper51.com ddlb_2.reset() 内容来自论文无忧网 www.paper51.com stringstr,xh,xm 内容来自www.paper51.com intch3,i,ch paper51.com DECLARE keming CURSOR FOR 内容来自论文无忧网 www.paper51.com
SELECT distinct"jiben1"."banming" http://www.paper51.com
FROM "jiben1" copyright paper51.com where"jiben1"."fangxiang"=:ddlb_1.text; paper51.com selectcount(distinct "jiben1"."banming") paper51.com into:ch3 copyright paper51.com
FROM"jiben1" copyright paper51.com where"jiben1"."fangxiang"=:ddlb_1.text; http://www.paper51.com openkeming; 内容来自www.paper51.com ddlb_3.reset() http://www.paper51.com
stringstr,xh,xm paper51.com intch3,i,ch 内容来自论文无忧网 www.paper51.com
DECLARE keming CURSOR FOR http://www.paper51.com
SELECT distinct"jiben1"."xuehao" copyright paper51.com FROM "jiben1" 内容来自论文无忧网 www.paper51.com where"jiben1"."banming"=:ddlb_2.text; 内容来自www.paper51.com selectcount(distinct "jiben1"."xuehao") paper51.com
into:ch3 http://www.paper51.com FROM"jiben1" 内容来自论文无忧网 www.paper51.com
where"jiben1"."banming"=:ddlb_2.text; 内容来自论文无忧网 www.paper51.com openkeming; 内容来自论文无忧网 www.paper51.com fori=1 to ch3 http://www.paper51.com fetch keming into :str; copyright paper51.com ddlb_3.additem(str) paper51.com
endfor copyright paper51.com
closekeming; 内容来自www.paper51.com stringstr,xh,xm 内容来自论文无忧网 www.paper51.com
intch3,i,ch copyright paper51.com
//DECLARE keming CURSOR FOR http://www.paper51.com |