最近在做课程设计--工资管理信息系统,我建了四张表:员工表employee(员工号emp_id、姓名emp_name、性别sex、部门号dept_id)、部门表dept(部门号dept_id、部门名称dept_name、月基本工资salary、津贴allow)、考勤表kaoqin(员工号emp_id、月份kmonth、加班时间jiaban、
事假天数shija)、月工资表msalary(员工号emp_id、月份mmonth、月工资m_salary)
现在做月工资的生成,月工资=部门基本工资+加班时间*津贴-事假*50
在窗口OPEN时间有如下代码,用来向ddlb_1填充1到12个数字,代表的是月份
string j
int i
for i=1 to 12 step 1
    j=string(i)
    ddlb_1.additem(j)
next
下面是生成按钮CLICKED下的代码
integer i,allow,jiaban,shijia
i=integer(ddlb_1.text)
long salary,extr=0
string emp,dept,j
declare xx cursor for //定义游标 XX,从员工表employee中取出员工号emp_id和部门号dept_id
select emp_id,dept_id
from employee;
open xx;
fetch xx into :emp,:dept;
do while sqlca.sqlcode=0
    if trim(emp)="" then
        continue;
    end if
    
    ddlb_2.additem(dept_id)//ddlb_2是我用来检测有没有取到部门号,结果是取到了,ddlb_2出现所有的部门号
    select salary,allow
    into :salary,:allow
    from dept
    where dept_id=:dept;//从部门表dept表中取出月基本工资salary和津贴allow
  j=string(allow)
  
  ddlb_3.additem(j) //用来检测有没有取到salary和allow,可结果是前面的全为空(没有数值),只有最后一个有数值,大概问题就出在这里
   
    select jiaban,shijia
    into :jiaban,:shijia
    from kaoqin
    where emp_id=:emp_id and kmonth=:i;
    
    extr=salary+allow*jiaban+shijia*(-50)
   
    
   insert into msalary
    values(:emp_id,:i,:extr);
    
    extr=0
    fetch xx into :emp,:dept;
loop
close xx;
我在一本书上看到这个时候该用游标嵌套,各位高手看看该怎么解决,为什么在游标里面用SELECT语句取不出所有数字,只能取最后一个数字,
我这个程序又该怎么写才好!
请指教!!



 
											





 
	    

 
	