Felipe Monteiro de Carvalho wrote:
Here is my database file:

ID,NAMEEN,NAMEPT,HEIGHT,WIDTH,PINS,DRAWINGCODE
1,resistor,resistor,1,1,1,LINE
2,capacitor,capacitor,1,1,1,LINE

When listing the value of the NAMEEN field it will show: NAMEEN,
resistor, resistor (yes, resistor again!)

The correct should be: resistor, capacitor

procedure TComponentsDatabase.FillStringListWithNames(AStringList: TStrings);
var
 i: Integer;
 CurField: TField;
begin
 AStringList.Clear;

 for i := 1 to FDataset.RecordCount do
 begin
   FDataset.RecNo := i;
   CurField := FDataset.FieldByName(STR_DB_COMPONENTS_NAMEEN);
   AStringList.Add(CurField.Value);
 end;
end;

Try this:

procedure TComponentsDatabase.FillStringListWithNames(AStringList: TStrings);
var
 i : Integer;
 CurField: TField;
begin
 AStringList.Clear;
 CurField := FDataset.FieldByName(STR_DB_COMPONENTS_NAMEEN);
 FDataset.First;
 while not FDataset.EOF do
  begin
   AStringList.Add(CurField.Value);
   FDataset.CursorPosChanged;
   FDataset.Next;
  end;
end;

Yours

Howard
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to