All pastes #413420 Raw Edit

Mine

public text v1 · immutable
#413420 ·published 2007-03-28 12:27 UTC
rendered paste body
//**********************************
//TABELA DE PEDIDO
//**********************************
Lista := TStringList.Create;
Lista.LoadFromFile('P:\PASTAS.TXT');
for Y := 0 to Lista.Count -1 do
begin
  Pasta := 'P:'+ Lista[Y] + 'dbPedidoPalm.pdb';
  //Verifica se o arquivo existe
  If FileExists('P:'+ Lista[Y] + 'dbPedidoPalm.txt') Then
  begin
    dm.TBPALMPEDIDO.Open;
    Str := TStringList.Create;
    Str.LoadFromFile('P:'+ Lista[Y] + 'dbPedidoPalm.txt');
    for i := 0 to Str.Count -1 do
    begin
       S := Str[i];
       dm.TBPALMPEDIDO.Insert;
    for X := 1 to 10 do
    begin
      dm.TBPALMPEDIDO.FieldByName(Campo[X]).AsString := StringReplace(Copy(S,1,Pos(#9,S)-1),'.' , ',',[RfReplaceAll]);
      Delete(S, 1, Pos(#9,S));
    end;
    dm.TBPALMPEDIDO.FieldByName(Campo[11]).AsString := StringReplace(Copy(S,1,Length(S)),'.' , ',',[RfReplaceAll]);
    dm.TBPALMPEDIDO.Post;
end;
Str.Free;
DeleteFile('P:'+ Lista[Y] + 'dbPedidoPalm.txt');
DeleteFile('P:'+ Lista[Y] + 'dbPedidoPalm.pdb');
lblResultadoPEDIDO.Caption := 'Foram importados: '+ IntToStr(dm.TBPALMPEDIDO.RecordCount)+' registros da tabela PEDIDO.';
end;
end;
Lista.Free;