Board index » delphi » Finding the current record on a query

Finding the current record on a query

I am new to using SQL and queries, thought I have used lots of local
databases.  My question is this: What is the best way to find a particular
record in a query result set?

My situation is as follows :
1) I display a query results to the user.
2) User wishes to modify one of the records.
3)  I pop up a window and let the user make changes to a record.
4)  I rerun the query to get the new data set.
5)  *** Here is my problem ***  : The query result set is now on the first
record.  I want to set the current record to be the one the user just
edited.  If this were a ttable I would just do a findkey.  How should I do
this here?  I do have a key value, but the dataset does not have an index
like a table.  I could iterate through the result set, but it seems that
there must be a better way.

Thanks

Kevin

 

Re:Finding the current record on a query


Why rerun the query. Use LiveResultSet and display data in a DBgrid. The
grid will show updates in the query without having to rerun.

elio

Re:Finding the current record on a query


Quote
>5)  *** Here is my problem ***  : The query result set is now on the first
>record.  I want to set the current record to be the one the user just
>edited.  If this were a ttable I would just do a findkey.  How should I do
>this here?

Use Locate.  Locate does not require and index

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads