1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34:
| procedure TForm1.Button2Click(Sender: TObject); var d : Textfile; Zeile, Feldname, TextTemp : String; i, Z : Integer; begin OpenDialog.Execute; TableTemp.DatabaseName := ExtractFilePath(ParamStr(0)); TableTemp.TableName := 'TTemp.DB'; TableTemp.CreateTable; TableTemp.Active := true; assignFile(d, OpenDialog.FileName); Reset(d); Progressbar.Position := 0; Progressbar.Max := FileSize(d); Label2.Caption := IntToStr(Progressbar.Max); while not EOF(d) do begin ReadLn(d,Zeile); Z := SizeOf(Zeile); TableTemp.Append; for i := 1 to 20 do begin Feldname := 'Feld'+IntToStr(i); TextTemp := copy(Zeile, 0, (POS(';', Zeile))); TableTemp.FieldByName(Feldname).AsString := copy(TextTemp, 1, length(TextTemp)-1); Zeile := copy(Zeile, length(TextTemp)+1, (length(Zeile)-length(TextTemp))); end; Progressbar.Position := Progressbar.Position + Z; Label3.Caption := IntToStr(Progressbar.Position); TableTemp.Post; end; closeFile(d); end; |