Solved

TSQLQuery.FindFirst

Posted on 2001-08-20
4
281 Views
Last Modified: 2010-04-04
Hi.

I know this is a silly question, but it's really bugging me.  I'm having a problem with FindFirst when used with a TSQLQuery (Delphi 6).  It just doesn't want to work.

Here's some code....

  EAQuery.SQL.Clear;
  EAQuery.SQL.Add('select * from CONTACT');
  EAQuery.Open;
  If EAQuery.FindFirst then ShowMessage('1st Record Found')
    else ShowMessage('There was a problem finding the 1st record');

EAQuery has been defined previously and the connection is working fine - I know that because I can retrieve values from the first row and can therefore retrieve the value from a "Select Count(*)" statement and check the value.

I need to use findFirst and findNext to enumerate the rows.

Any thoughts or suggestions?

John.
0
Comment
Question by:Jaymol
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 50 total points
ID: 6405874
hmmm

  I'm not sure if I understood you well, but if you want to move between the records, use First, Next, Last and Prior

0
 
LVL 6

Author Comment

by:Jaymol
ID: 6406065
Thanks, but I'm saying that FindFirst is not working.

John.
0
 
LVL 4

Expert Comment

by:fva
ID: 6406131
FindFirst is an internal method used for navigating within a filtered data set. You did not set any filter (at least not in the example you posted).

But really, wouldn't you get into a performance problem if you do filtering over a remote-obtained result-set? Usually far better performance is obtained by restricting the result set in the select statement itself. Thus, the hard work is done at the server level (I presume you have a true SQL backend since you mentioned some connection) and even the network traffic may be significantly reduced.

But yet again your particular setup might require it so I'm just placing a suggestion.

F.
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6406149
Sorry, I misunderstood your comment.  Using First and Next, not FindFirst and FindNext, is exactly what I wanted.

Fva, this application will be used maybe twenty to thirty times a year so I'm not concerned about performance issues, but thanks for the tips.  Worth bearing in mind in the future.

Thanks guys,

John.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

766 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