Groups > Borland > Delphi upgrade > Delphi 6.0 TClientDataset1




Delphi 6.0 TClientDataset1

Delphi 6.0 TClientDataset1
Tue, 4 Mar 2008 15:55:59 +0100
Hi,

In my program, I try to load some Data in a TClientDataset (*.cds-file). I
have a DBlistBox to show the data. So far, this works correct. I then want
to transfer the selected Data of the DBListBox using ItemIndex into
different Edit-Components by a Button "Select". Now the program fails:
One
of the Edit-Boxes shows arbitrary data, while the others show correct data.
The codes is:

procedure TForm2.SelectButtonClick(Sender: TObject);
var i,j,Delta_X:Integer;
begin
  i:=DBListBox1.Itemindex;
  Edit1.Text:=IntToStr(i);  // works correctly
  ClientDataSet1.First;
  ClientDataSet1.MoveBy(i);
  Edit3.Text:=ClientDataset1.FieldByName('ID-No.').AsString;  // failure!!!,
shows arbitrary data,
  Edit2.Text:=ClientDataset1.FieldByName('DA [mm]').AsString; // this works
correct
  DBListBox1.ItemIndex:=i;
end;

Who can help?

Software: Delphi 6.0 Professional, Win 2000, SP 4

R. Elsing



Post Reply
about | contact