天下之大,无奇不有!有答就有分
这里有注释的地方,赋值部分我需要从另外一个表里读出来,比如!Parameters.ParamByName('InpDep').Value:=StrGrInport.Cells[8,i]; 这里的 StrGrInport.Cells[8,i]我需要从另外一个表里读出来另外的一个值来代替,如select id from oinfo where sname = StrGrInport.Cells[8,i]. 这里如何写? access数据库!! 帮我写一句!谢谢
如下:
sql.Add('insert into stainfo(stano,sname,sex,birth,tel,mobile,email,depid,sorts,duty,provi,folk,level,special,cardno,recno,politics,slevel,married,indate,dutystate,dutydate,stadate,leftdate,baryear,barstart,barend,school,gradate,body,address,pcode,des)'+
'values(:InpStano,:InpSname,:InpSex,:InpBirth,:InpTel,:InpMobile,:InpEmail,:InpDep,:InpSorts,:InpDuty,:InpProvi,:InpFolk,:InpLev,:InpSpec,:InpCardno,:InpRecno,:InpPolitics,:InpSlevel,:InpMarried,:InpIndate,'+
':InpDutyState,:InpDutyDate,:InpStaDate,:InpLeftDate,;InpBaryYear,;InpBarStart,:InpBarEnd,:InpSchool,:InpGraDate,:InpBody,:InpAddress,:InpPcode,:InpDes)');
Parameters.ParamByName('InpStano').Value:=strgrinport.Cells[1,i];
.......
Parameters.ParamByName('InpDep').Value:=StrGrInport.Cells[8,i]; //数字,要读取其他表获得
Parameters.ParamByName('InpSorts').Value:=StrGrInport.Cells[9,i]; //数字,要读取其他表获得
Parameters.ParamByName('InpDuty').Value:=StrGrInport.Cells[10,i]; //数字,要读取其他表获得
Parameters.ParamByName('InpProvi').Value:=StrGrInport.Cells[11,i];
Parameters.ParamByName('InpFolk').Value:=StrGrInport.Cells[12,i]; //数字,要读取其他表获得
Parameters.ParamByName('InpLev').Value:=StrGrInport.Cells[13,i]; //数字,要读取其他表获得
Parameters.ParamByName('InpSpec').Value:=StrGrInport.Cells[14,i]; //数字,要读取其他表获得
.......
ExecSQL;
Close;