Ver Mensaje Individual
  #18  
Antiguo 18-08-2005
danytorres danytorres is offline
Miembro
 
Registrado: may 2003
Ubicación: Venezuela. Edo Carabobo
Posts: 361
Reputación: 22
danytorres Va por buen camino
Gracias por responder el codigo es el siguiente;

Code:
__________________________________________________________

procedure TInventarios.Button2Click(Sender: TObject);
vAR
Archivo,Campos: TStringList;
I, J: Integer;
Codigo: string;
Cant : real;
Linea : Integer;
begin
Archivo:= TStringList.Create;
Campos:= TStringList.Create;

try
Archivo.LoadFromFile('C:\INVENTARIO.txt');


for I := 0 to Archivo.Count -1 do
begin

Campos.Clear;
Campos.CommaText:= Archivo[i];
Codigo:= Campos[0];
Cant:= Strtofloat(Campos[1]);

If (Codigo <> '') and (Cant > 0) then
begin


Linea:= Linea + 1;
DataModule1.STOMOV.Insert;
DataModule1.STOMOV.Fields[1].Value := 1;
DataModule1.STOMOV.Fields[3].Value := Linea;
DataModule1.STOMOV.Fields[4].Text := DateToStr(Now);
DataModule1.STOMOV.Fields[5].Value := 530;
DataModule1.STOMOV.Fields[7].Value := strToInt(Edit4.text);
DataModule1.STOMOV.Fields[8].Text := Codigo;
DataModule1.STOMOV.Fields[9].Value := Cant;
DataModule1.STOMOV.Post;
end;

end;

finally
Archivo.Free;
Campos.Free;
end;
________________________________________________________________

Y el txt tine esta forma:
_______________________________________
802404041500080,1800,
, ,
802404041500080,1800,
_______________________________________

Que puedo hacer?
__________________
____________________________
Un saludo a todos...
Responder Con Cita