Board index » delphi » do FindKey using TQuery

do FindKey using TQuery

Dear all,

How do I finish TTable.FindKey job using TQuery? Thanks.

--
Best regards,
Lurc

 

Re:do FindKey using TQuery


On Wed, 22 Mar 2000 13:57:20 +0800, "lurc" <lurc...@hotmail.com>
wrote:

Quote
>How do I finish TTable.FindKey job using TQuery?

If you mean finding a specific record in a query result set without
restricting the result set using a new query, the answer is to use
Locate.

Jan

Re:do FindKey using TQuery


To find a record with a query change the WHERE clause and rerun the query.
If you really want to search within a query result set use the TQuery.Locate
method.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Re:do FindKey using TQuery


Thanks.

And I have a further question, if I want to locate a record based on a
string field and a Date field, how should I do?

--
Best regards,
Lurc

Re:do FindKey using TQuery


There are a couple of ways.

var
  V:    Variant;
begin
  V := VarArrayCreate([0..1], varVariant);
  V[0] := MyStringVariable;
  V[1] := MyDateVariable;
  Query1.Locate('MyStringField;MyDateField', V, []);

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Other Threads