Page 1 of 1

Position after msQuery1.execute

Posted: Mon 04 Jun 2012 10:01
by formi
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

Re: Position after msQuery1.execute

Posted: Mon 04 Jun 2012 12:05
by AlexP
Hello,

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