database - Delete and refresh a record in DBgrid where u maintain the same position -
i have small database i'm using dbgo, have dbgrid displaying records, need know how delete record , refresh database index arrow stays in same position or @ least go next? index arrow jump start form beginning each time refresh !
just keep , reset recno
var i:integer; ....... := ads.recno; ads.delete; ads.recno := i;
an example implementation usage dbnavigator be
procedure deleteandkeeprecno(ads: tcustomadodataset); var rn: integer; begin rn := ads.recno; ads.delete; ads.recno := rn; end; procedure tform4.dbnavigator1click(sender: tobject; button: tnavigatebtn); begin if button = nbdelete begin deleteandkeeprecno (tcustomadodataset(tdbnavigator(sender).datasource.dataset)); abort; end; end;
Comments
Post a Comment