以下是引用hnsmxyz在2014-4-8 15:11:32的发言:
数据表名,不能以数字开头
坚守VFP最后的阵地
Close Databases Create Cursor t (科目 C(20),分数线 N(6,2)) Use cj12 In 0 Alias cj12 && 改成你的表名 lcstr="100,200,300" && 分数线 Select cj12 For lnJ=1 To ALines(aa,Strtran(lcstr,",",Chr(13)+Chr(10))) For lnI=2 To 5 && 为你表中各门功课字段的顺序号 myField=Field(lnI) Index On -&myField To mc Copy To cj Fields &myField Insert Into t select myField+"_"+aa[lnJ],Evaluate(myField) From cj where Recno()=Val(aa[lnJ]) Use in cj EndFor Select cj12 EndFor Select T BROWSE Use in t Erase cj.dbf
clear Close Databases Create Cursor t (科目 C(20),分数线 N(6,2)) Use cj12 In 0 Alias cj Local Afs(3) Afs[1]=100 Afs[2]=200 Afs[3]=300 Select cj For lnJ=1 To Alen(Afs) For lnI=2 To 5 && 成绩字段序号 myField=Field(lnI) Index On -&myField To mc Copy To Array Acj Fields &myField Append Blank In t Replace 科目 With myField+'-'+Transform(Afs[lnJ]),分数线 With Acj[Afs[lnJ]] In t EndFor EndFor Select t Browse