Solved

TSQLQuery.FindFirst

Posted on 2001-08-20
4
274 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:
mnasman 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now