Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Test on empty dataset
Thu, Feb 28 2013 11:00 AMPermanent Link

Christian Ahlgrimm

Hallo,

has someone already found out, how to test, if a dataset returns no records ? (replacement for dataset.recordcount).
I didn't found it here....

hopefull
christian
Thu, Feb 28 2013 11:14 AMPermanent Link

Alvaro

Hi Christian:

Try this:

property EOF: Boolean
Usage

Indicates whether the row pointer is on the last row in the set of rows in the dataset. This property is only set to True if the Last method is called, the row pointer attempts to navigate beyond the last row using the Next method, or if the dataset is empty.

Alvaro
Thu, Feb 28 2013 12:48 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Christian,

<< has someone already found out, how to test, if a dataset returns no
records ? (replacement for dataset.recordcount). I didn't found it here....
>>

http://www.elevatesoft.com/manual?action=viewprop&id=ewb1&comp=TDataSet&prop=RowCount

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Mar 1 2013 5:37 AMPermanent Link

Christian Ahlgrimm

Thanks all for your help, next time I will spend more time in reading...

But: next problem:
my goal was to inform the user about the number of records of a sql-dataset.
I put the rowcount in a  panel.caption with the following procedure.
But the rowcount is rigth only from then second time of execution the procedure.
After first execution the rowcount is  wrong,

procedure:

mydataset.Params.Clear;
mydataset.Params.Add ('_name =''' +trim (label2.caption) +'''');
database.load(mydataset);
mydataset.first;
if mydataset.rowcount=0 then
  window.alert('nothing !')
else begin
   panel1.caption:=inttostr(mydataset.rowcount)+' records';
   panel1.visible:=true;
end;

any iIdea's ?

christian
Fri, Mar 1 2013 5:57 AMPermanent Link

Walter Matte

Tactical Business Corporation


This Code needs to be moved to the AfterLoad event of the MyDataset.

mydataset.first;
if mydataset.rowcount=0 then
  window.alert('nothing !')
else begin
   panel1.caption:=inttostr(mydataset.rowcount)+' records';
   panel1.visible:=true;
end;


You cannot program the same way you do in delphi.... when you call

database.load(mydataset);

it doesn't wait for the code to execute, (it can't ... got to get to the server etc.) Use the AfterLoad.

Walter






Christian Ahlgrimm wrote:

Thanks all for your help, next time I will spend more time in reading...

But: next problem:
my goal was to inform the user about the number of records of a sql-dataset.
I put the rowcount in a  panel.caption with the following procedure.
But the rowcount is rigth only from then second time of execution the procedure.
After first execution the rowcount is  wrong,

procedure:

mydataset.Params.Clear;
mydataset.Params.Add ('_name =''' +trim (label2.caption) +'''');
database.load(mydataset);
mydataset.first;
if mydataset.rowcount=0 then
  window.alert('nothing !')
else begin
   panel1.caption:=inttostr(mydataset.rowcount)+' records';
   panel1.visible:=true;
end;

any iIdea's ?

christian
Image