with Qry_Info do begin Edit; Post; end; with Qry_Field do begin Close; SQL.Clear; SQL.Add('select * from T_Import where F_Field<>'''+' '+''' and tablename='''+tablename+''''); Open; end; for i:=1 to Qry_Field.RecordCount do begin F_Field:=Qry_Field.FieldByName('F_Field').AsString; //源字段 S_Field:=Qry_Field.FieldByName('S_Field').AsString; //映谢字段 Qry_Field.Next; end; if tablename='custom' then begin Btn_Start.Enabled:=False; Screen.Cursor:=crHourglass; Frm_Data.OpenDataSet(Qry_Import,'Select * from custom'); o:=0; p:=0; for i:=1 to Frm_Main.b_row-1 do begin ProgressBar1.Max:=Frm_Main.b_row-1; Frm_Data.ADOConnection1.BeginTrans; try with Qry_Import do begin Append; For k:=1 to Qry_Field.RecordCount do begin m:=Frm_Main.ImportFields.IndexOf(F_Field[k])+1; for l:=1 to Qry_Field.RecordCount do begin FieldByname(S_Field[k]).AsString:=Frm_Main.eclApp.activesheet.cells.item[i+1,m].Text; end; end; Post; end; inc(o); Frm_Data.ADOConnection1.CommitTrans; except Frm_Data.ADOConnection1.RollbackTrans; Inc(p); end; ProgressBar1.Position:=i; end; MessageDlg(Pchar('导入数据完成,导入成功 '+inttostr(o)+' 条,导入失败 '+inttostr(p)+' 条'),mtConfirmation, [mbOK], 0); Screen.Cursor:=crDefault;我这边导入代码是这样的 对你的代码还不是很理解 希望可以指导一下