I have located the UserID I want in my database but I want to search for the user's PIN in that same row -- is it possible?
I'm using:
tbl1.locate('Column-name' , *Search value*, []);
Now I want to get the value of the userpin column in that same row.
It's better to use TQuery
for this:
var Query : TQuery;
PIN : string;
begin
Query.Sql.Text := 'SELECT pin FROM table WHERE id = value'
Query.Open;
PIN :+ Query.FieldByName('pin').AsString;
Query.Close
end;
Using the Locate
is also OK (together with FieldByName
), but I prefer to use it only to select the row in an TDBGrid
.