type
TStruct = Record
OrderNo : Integer;
ItemNo : Integer;
PartNo : Integer;
Qty : Integer;
Discount : Integer;
// Example : string[10]
end;
var
Form1: TForm1;
implementation
uses DateUtils;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Path : String;
F : file of TStruct;
FData : TStruct;
begin
Path := ExtractFilePath(Application.ExeName)+'Data.txt';
AssignFile(F, Path);
Rewrite(F);
Table1.First;
while not Table1.Eof do begin
FData.OrderNo := Table1.FieldByName('OrderNo').AsInteger;
FData.ItemNo := Table1.FieldByName('ItemNo').AsInteger;
FData.PartNo := Table1.FieldByName('PartNo').AsInteger;
FData.Qty := Table1.FieldByName('Qty').AsInteger;
FData.Discount := Table1.FieldByName('Discount').AsInteger;
Write(F, FData);
Table1.Next;
end;
CloseFile(F);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Path : String;
F : file of TStruct;
FData : TStruct;
Str : String;
begin
Path := ExtractFilePath(Application.ExeName)+'Data.txt';
AssignFile(F, Path);
Reset(F);
while not Eof(F) do begin
Read(F, FData);
Str := IntToStr(FData.OrderNo)+IntToStr(FData.ItemNo)+IntToStr(FData.PartNo)+IntToStr(FData.Qty)+IntToStr(FData.Discount);
Memo1.Lines.Add(Str);
end;
type
TStruct = Record
OrderNo : Integer;
ItemNo : Integer;
PartNo : Integer;
Qty : Integer;
Discount : Integer;
// Example : string[10]
end;
var
Form1: TForm1;
implementation
uses DateUtils;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Path : String;
F : file of TStruct;
FData : TStruct;
begin
Path := ExtractFilePath(Application.ExeName)+'Data.txt';
AssignFile(F, Path);
Rewrite(F);
Table1.First;
while not Table1.Eof do begin
FData.OrderNo := Table1.FieldByName('OrderNo').AsInteger;
FData.ItemNo := Table1.FieldByName('ItemNo').AsInteger;
FData.PartNo := Table1.FieldByName('PartNo').AsInteger;
FData.Qty := Table1.FieldByName('Qty').AsInteger;
FData.Discount := Table1.FieldByName('Discount').AsInteger;
Write(F, FData);
Table1.Next;
end;
CloseFile(F);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Path : String;
F : file of TStruct;
FData : TStruct;
Str : String;
begin
Path := ExtractFilePath(Application.ExeName)+'Data.txt';
AssignFile(F, Path);
Reset(F);
while not Eof(F) do begin
Read(F, FData);
Str := IntToStr(FData.OrderNo)+IntToStr(FData.ItemNo)+IntToStr(FData.PartNo)+IntToStr(FData.Qty)+IntToStr(FData.Discount);
Memo1.Lines.Add(Str);
end;
end;