Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TClientDataSet

1 view
Skip to first unread message

Rainer.Elsing

unread,
Mar 4, 2008, 10:01:52 AM3/4/08
to
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


Rich Werning

unread,
Mar 11, 2008, 1:40:15 PM3/11/08
to
Chances are that you aren't looking at the data you think you are. Why not
drop a TDBGrid onto the screen, and connect it to the datasource of your
ClientDataset. Now you should be able to see exactly what fields are in
that clientdataset, and what the values of each row / column are.

I'm guessing that either the query is returning incorrect information, your
also setting the value of your edit3 field somewhere else, or you're doing
something with a calculated field that is changing the value of the "ID-No"
field.

--
Rich Werning
TIP Technologies, Inc.


"Rainer.Elsing" <Rainer...@t-online.de> wrote in message
news:fqjo0r$oif$01$1...@news.t-online.com...

0 new messages