用VFP统计学生成绩分数段,运行时出现错误,就大神指点!
小弟自学VFP,都是模仿书上的,遇到一些问题求指点迷津![local]1[/local]
[local]4[/local]
[local]5[/local]
代码如下:
n=thisform.pageframe1.activepage &&当前页
sele 学生选课
set filter to substr(bjbh,2,8)=substr(学号,3,8)and kcbh=课程编号
*计算分数
count to s
count to s_40 for 成绩<40
count to s40_49 for 成绩>=40 and 成绩<49
count to s50_59 for 成绩>=50 and 成绩<59
count to s60_69 for 成绩>=60 and 成绩<69
count to s70_79 for 成绩>=70 and 成绩<79
count to s80_89 for 成绩>=80 and 成绩<89
count to s90_100 for 成绩>=90 and 成绩<=100
*统计百分比
if s#0
bs_40=s_40/s*100
bs40_49=s40_49/s*100
bs50_59=s50_59/s*100
bs60_69=s60_69/s*100
bs70_79=s70_79/s*100
bs80_89=s80_89/s*100
bs90_100=s90_100/s*100
else
store 0 to bs_40,bs40_49,bs50_59,bs60_69,bs70_79,bs80_89,bs90_100
endif
do case
case n=1&&第一页
thisform.pageframe1.page1.text1.value=s_40
thisform.pageframe1.page1.text3.value=s40_49
thisform.pageframe1.page1.text5.value=s50_59
thisform.pageframe1.page1.text7.value=s60_69
thisform.pageframe1.page1.text9.value=s70_79
thisform.pageframe1.page1.text11.value=s80_89
thisform.pageframe1.page1.text13.value=s90_100
thisform.pageframe1.page1.text2.value=round(bs_40,2)
thisform.pageframe1.page1.text4.value=round(bs40_49,2)
thisform.pageframe1.page1.text6.value=round(bs50_59,2)
thisform.pageframe1.page1.text8.value=round(bs60_69,2)
thisform.pageframe1.page1.text10.value=round(bs70_79,2)
thisform.pageframe1.page1.text12.value=round(bs80_89,2)
thisform.pageframe1.page1.text14.value=round(bs90_100,2)
case n=2
thisform.pageframe1.page2.container1.shape1.height=int(130/100*bs_40)
thisform.pageframe1.page2.container1.shape1.top=int(106/100*bs_40)
thisform.pageframe1.page2.container1.shape2.height=int(130/100*bs40_49)
thisform.pageframe1.page2.container1.shape2.top=int(106/100*bs40_49)
thisform.pageframe1.page2.container1.shape3.height=int(130/100*bs50_59)
thisform.pageframe1.page2.container1.shape3.top=int(106/100*bs50_59)
thisform.pageframe1.page2.container1.shape4.height=int(130/100*bs60_69)
thisform.pageframe1.page2.container1.shape4.top=int(106/100*bs60_69)
thisform.pageframe1.page2.container1.shape5.height=int(130/100*bs70_79)
thisform.pageframe1.page2.container1.shape5.top=int(106/100*bs70_79)
thisform.pageframe1.page2.container1.shape6.height=int(130/100*bs80_89)
thisform.pageframe1.page2.container1.shape6.top=int(106/100*bs80_89)
thisform.pageframe1.page2.container1.shape7.height=int(130/100*bs90_100)
thisform.pageframe1.page2.container1.shape7.top=int(106/100*bs90_100)
thisform.pageframe1.page2.label9.caption=str(s/4,2)
thisform.pageframe1.page2.label10.caption=str(s/2,2)
thisform.pageframe1.page2.label11.caption=str(s*3/4,2)
thisform.pageframe1.page2.label12.caption=str(s,2)
endcase