Append和UpdateBatch

try

   //查询qry2表

   qry2.SQL.Clear;

   qry2.SQL.Add('SELECT top 0 ChePaiHao,ZongZhong,ZhouShu,XianZhong,ShiJian,BanCi,YuanXuHao,ZhanID,ChaoXianLv  FROM CL');

   qry2.Open;

  if qry1.RecordCount > 0 then

  Writelog('......上传数据中......');

  while not qry1.Eof do

  begin

    qry2.Append;

    qry2.FieldByName('ChePaiHao').AsString := qry1.Fields[0].AsString;

    qry2.FieldByName('ZongZhong').AsString := qry1.Fields[1].AsString;

    qry2.FieldByName('ZhouShu').AsString := qry1.Fields[2].AsString;

    qry2.FieldByName('XianZhong').AsString := qry1.Fields[3].AsString;

    qry2.FieldByName('ShiJian').AsString := qry1.Fields[4].AsString;

    qry2.FieldByName('BanCi').AsString := qry1.Fields[5].AsString;

    qry2.FieldByName('YuanXuHao').AsString := qry1.Fields[6].AsString;

    qry2.FieldByName('ZhanID').AsString := zhanId;   //工作站ID,需要手动设置

    qry2.FieldByName('ChaoXianLv').AsString := qry1.Fields[7].AsString;

    qry2.Post; //保存

    qry1.next;

  end;

  //执行提交

  qry2.UpdateBatch();

  Writelog('上传数据完毕');

  except on E:Exception do

    Writelog('***上传数据到服务器失败***');

  end;

你可能感兴趣的:(update)