Subject Re: Equivalent SQL to Dataset.Locate statement
Author mikcaau
--- In firebird-support@yahoogroups.com, "Nols Smit" <nols@...> wrote:
>
> Hi.
>
>
> In a FireBird 1.5 and Delphi 7 application, when the user transmit a
key value of a table, I use the Pascal DataSet.Locate statement:
> if not IBDRegister.Locate('Specimen_Nr', VarArrayOf([This_ID]),
[loPartialKey]) then
> ShowMessage('No such record!');
>
> But it seems very slow in execution. What will the equivalent SQL
Select statement be to locate a specific record but not to limit the
user to that record located. In other words: After execution of the
statement, the user must be able to move to previous and next record.
>
>
> Regards,
>
> Nols Smit
The query
Select Specimen_Nr
from SomeTable
where Specimen_Nr = :SpecNo

In Delphi
Transaction.active := true;
If not prepared then prepare;
ParamByName('SpecNo').asString := "'%" + Param + "%'";
execQuery;

if not FieldByName('Specimen_Nr').IsNull then begin
ShowMessage('No such record!');
end else begin
ShowMessage('Record found!');
end;

If Transaction.InTransaction then Transaction.Commit;

mick