Thread View: borland.public.delphi.database.win32
2 messages
2 total messages
Started by Rainer.Elsing
Tue, 04 Mar 2008 15:01
TClientDataSet
Author: Rainer.Elsing
Date: Tue, 04 Mar 2008 15:01
Date: Tue, 04 Mar 2008 15:01
28 lines
1897 bytes
1897 bytes
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
Re: TClientDataSet
Author: Rich Werning
Date: Tue, 11 Mar 2008 17:40
Date: Tue, 11 Mar 2008 17:40
53 lines
2536 bytes
2536 bytes
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.Elsing@t-online.de> wrote in message
news:fqjo0r$oif$01$1@news.t-online.com...
> 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
>
>
>
>
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads