我现在定下来的有学生表、专业表、课程表、班级表,字段和你说的差不多,主索引分别是xh,zydm,kch,bjmc.
现在的问题就是成绩表不好定,年级和学期是小事,有和没有关系不大,看有没什么好的方法。学生与课程是一对多,学生与成绩也是一对多,成绩和课程还有联系,所以不知道怎么再投影分解了,不分解的话那记录数真有点多,学校的机子都是老爷机,还有内存256的,怕直接挂掉。
SELECT C06,C01,C03,C07,C04,C05,C02,C09,C08,C51,C52 FROM cjb20.dbf INTO ARRAY TEMP R=272 &&代表行数 C=11 &&代表列数 LOCAL NewTemp(R*C) i=1 j=1 FOR n=1 TO R*C IF i<=R IF j<=C NewTemp(n)=Temp(i,j) ELSE i=i+1 j=1 NewTemp(n)=Temp(i,j) ENDIF j=j+1 ENDIF ENDFOR USE h:\VFP\DATA\TABLES\cjk.dbf SELECT cjk FOR k=1 TO R*C GO BOTTOM APPEND BLANK REPLACE cj WITH NewTemp(k) IF EOF() EXIT ENDIF SKIP ENDFOR BROWSE
R=272 C=11 SELECT C06,C01,C03,C07,C04,C05,C02,C09,C08,C51,C52 FROM cjb20.dbf INTO ARRAY ARRA1 SELECT xh FROM cjb20.dbf INTO ARRAY ARRA2 DIMENSION ARRA3(C) ARRA3(1)="C06" ARRA3(2)="C01" ARRA3(3)="C03" ARRA3(4)="C07" ARRA3(5)="C04" ARRA3(6)="C05" ARRA3(7)="C02" ARRA3(8)="C09" ARRA3(9)="C08" ARRA3(10)="C51" ARRA3(11)="C52" DO Cj WITH R,C,ARRA1 DO XH WITH R,C,ARRA2 DO KC WITH R,C,ARRA3 PROCEDURE CJ LPARAMETERS Row,Colu,Arra LOCAL NewArra(Row*Colu) i=1 j=1 FOR n=1 TO Row*Colu IF i<=Row IF j<=Colu NewArra(n)=Arra(i,j) ELSE i=i+1 j=1 NewArra(n)=Arra(i,j) ENDIF j=j+1 ENDIF ENDFOR USE data\tables\cjk.dbf SELECT cjk FOR k=1 TO Row*Colu GO BOTTOM APPEND BLANK REPLACE cj WITH NewArra(k) IF EOF() EXIT ENDIF SKIP ENDFOR RETURN ENDPROC PROCEDURE XH LPARAMETERS Row,Colu,Arra a=RECCOUNT()-Row*Colu USE h:\vfp\data\tables\cjk.dbf SELECT cjk GO a+1 FOR k=1 TO Row FOR n=1 TO Colu REPLACE xh WITH Arra(k) IF EOF() EXIT ENDIF SKIP ENDFOR ENDFOR RETURN ENDPROC PROCEDURE KC LPARAMETERS Row,Colu,Arra a=RECCOUNT()-Row*Colu USE h:\vfp\data\tables\cjk.dbf SELECT cjk GO a+1 FOR k=1 TO Row FOR n=1 TO Colu REPLACE kch WITH Arra(n) IF EOF() EXIT ENDIF SKIP ENDFOR ENDFOR RETURN ENDPROC