Position after msQuery1.execute

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
formi
Posts: 39
Joined: Thu 17 Apr 2008 13:01

Position after msQuery1.execute

Post by formi » Mon 04 Jun 2012 10:01

For performance-reasons I ask me, if always the first record is selected after an execute-command or if I have to call Query1.First to be shure that it is the first record. Example:

Query1.SQL.Text := 'SELECT * FROM myTable ORDER BY myField';
Query1.Execute;
Query1.First; //Is this line necessary?
WHILE not Query1.eof do
......

Thanks for your answer, Peter

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Position after msQuery1.execute

Post by AlexP » Mon 04 Jun 2012 12:05

Hello,

It is not necessary to call the First method. After calling the Execute method cursor will be automaticaly set to the first record.

Post Reply