Delphi - restore actual row in DBGrid

后端 未结 4 2027
野趣味
野趣味 2021-01-03 03:47

D6 prof.

Formerly we used DBISAM and DBISAMTable. That handle the RecNo, and it is working good with modifications (Delete, edit, etc).

Now we replaced with

4条回答
  •  既然无缘
    2021-01-03 04:02

    Record position depends much on the sort order of resultset you got from the Query/Table object. If you don't order at all, the order you get from the server is implementation defined and such, can't guarantee that records come in the same order when reopen the query, even if no changes happened. At least in MSSQL and Firebird, results come in different orders if no Order By clause is used.

    As for repositioning, I think that TOndrej solution is the safest one - using the primary key of your resultset to reposition the grid on the right record.

提交回复
热议问题