Board index » delphi » simple... cant figur it out.

simple... cant figur it out.

Quote
In article <3b4af22d_2@dnews>, m...@here.com wrote...

Hi,

Quote
> Now here is where in stuck, the IBQuery1.RecordCount always return 1 but
> there is like 15 entries in the DB any ane know why??

Record Count will only show the number of records returned to the
client, not the number in the database.

Cheers

 

Re:simple... cant figur it out.


Hello

I just wanted to try out IB but i cant seem to get it working... here is
what i did:
I dropped a TIBDatabase, TIBTransaction and a TIBQuery on delphi form.
I set the DatabaseName to 127.0.0.1:C:\Program Files\Borland\InterBase
\examples\Database\employee.gdb
the defaultTransaction to my TIBTransaction and the user pass to access
the database....

Now i use the folowing code:
IBQuery1.SQL.Clear;
IBQuery1.SQL.Add('select CUSTOMER, POSTAL_CODE from CUSTOMER');
IBQuery1.Active:=true;
//just for display
memo1.Lines.Add(IntToStr(IBQuery1.RecordCount));
memo1.Lines.Add(IBQuery1.fieldbyname('CUSTOMER').AsString);
memo1.Lines.Add(IBQuery1.fieldbyname('POSTAL_CODE').AsString);

Now here is where in stuck, the IBQuery1.RecordCount always return 1 but
there is like 15 entries in the DB any ane know why??

Thanks
Christian

Re:simple... cant figur it out.


Quote
> Record Count will only show the number of records returned to the
> client, not the number in the database.

Ok but in this case i should have 15... there is no "where ..= ..."

Re:simple... cant figur it out.


Recordcount shows how many Records where fetched by Your Application.#
If You have 15 Records and a DBGrid that is showing 5 Rows, then only 5
Records must be fetched to fill the DBGrid. In this case Recordcount shows
5.
If the DBGrid ist higher so that it shows 10 Rows, then RecordCoung shows
10.
In Your case only one Record was fetched.
To show the true RecordCount You have to do a DataSet.Last after opening the
DataSet.
Ceep in mind that this could take very long depending on how many Records
are in the DataSet.

Another (and maybe better) Way of showing the RecordCount ist to use IBQuery
(or IBQSL) that does the counting (i.e. select count(primary_key) from
mytable).
In this case the work is done by the Server and only one Value must be sent
over the Network.

Regards,
Strike.SoftwareSolutions
Wolfgang Bierl
"Christian" <m...@here.com> schrieb im Newsbeitrag news:3b4af4bb_1@dnews...

Quote
> > Record Count will only show the number of records returned to the
> > client, not the number in the database.

> Ok but in this case i should have 15... there is no "where ..= ..."

Re:simple... cant figur it out.


Ha ok i get it now thanks.

Christian

Re:simple... cant figur it out.


Also please check my site for more IBX info:

IB/IBX FAQ
http://ib.freeservers.com

HTH,

-Jorge

"Christian" <m...@here.com> escribi en el mensaje news:3b4b0684$1_2@dnews...

Quote
> Ha ok i get it now thanks.

Other Threads