Solved

Query.recordcount always gives 1 record ?

Posted on 2004-08-13
2
147 Views
Last Modified: 2010-04-05
Hi

Can anyone help me with this problem.

I hava a Paradox table. When I use a Query, and I know for certain, that the result will be an empty query, the recordcount of that query gives me 1 record instead of 0 . When there is one record that matches the query, the recordcount is also one !!!

quid ?

thx a lot
0
Comment
Question by:marioway
2 Comments
 
LVL 12

Accepted Solution

by:
esoftbg earned 50 total points
ID: 11797700
Try to use another query when you need to know the count of records:

function  TForm1.CountOfRecords(TableName: string): Integer;
var
  Count: Integer;
begin
  Count := 0;
  try
    QueryCount.Active := False;
    QueryCount.SQL.Text :=''
                        + 'SELECT COUNT(*) FROM '
                        + TableName
                        + '';
    QueryCount.Active := True;
    Count := QueryCount.Fields[0].AsInteger;
  finally
    Result := Count;
  end;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  EditCount.Text := IntToStr(CountOfRecords('EMPLOEE'));
end;
0
 

Author Comment

by:marioway
ID: 11799847
Thank You very much esoftbg

Marioway
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Internet Explorer View Settings Question 15 116
oracle global variables 4 76
Installshield for Embarcadero EX 10.1 Berlin 4 60
Tidtcpserver listening on multiports? 1 35
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question