Solved

TSQLQuery.FindFirst

Posted on 2001-08-20
4
286 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

690 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