for j:=0 to 9999 do //最大10000行 begin RPS.Max:=9999; Cells1:=VarToStr(MyExcel.Cells[j+2,1].Value); //Org Cells2:=VarToStr(MyExcel.Cells[j+2,2].Value); //BoxNO Application.ProcessMessages; SError.Caption:='正在匯入...'; RPS.Position:=RPS.Position+1; if (Cells1<>'') and (Cells2<>'')then begin DeleteSN(Cells2); Append; fieldbyname('Org').AsString:=Cells1; fieldbyname('BoxNO').AsString:=Cells2; fieldbyname('BoxType').AsString:=CheckFormat(Cells2); fieldbyname('IOTime').AsDateTime:=Now; Post; end else break; end;
一个一个单元格读取吧。
begin
RPS.Max:=9999;
Cells1:=VarToStr(MyExcel.Cells[j+2,1].Value); //Org
Cells2:=VarToStr(MyExcel.Cells[j+2,2].Value); //BoxNO
Application.ProcessMessages;
SError.Caption:='正在匯入...';
RPS.Position:=RPS.Position+1;
if (Cells1<>'') and (Cells2<>'')then
begin
DeleteSN(Cells2);
Append;
fieldbyname('Org').AsString:=Cells1;
fieldbyname('BoxNO').AsString:=Cells2;
fieldbyname('BoxType').AsString:=CheckFormat(Cells2);
fieldbyname('IOTime').AsDateTime:=Now;
Post;
end else break;
end;