Hi, I don't use data aware controls too often, but as I'm updating a legacy application I have to use them.
Please take a look at this code. DataModule1.SQLQuery1 is a simple "select * from customers limit 10". What I want to accomplish is the refreshing of a DBGrid *without losing the focused row*, that's why I use a TBookmark.
To me, the code looks correct, but I'm getting a SIGSEGV while assigning the bookmark. I must add the error only happens the 2nd or 3rd time this method is called:
var
lOldStatus: string;
lBookmark : TBookmark;
begin
lOldStatus := StatusBar1.Panels[1].Text;
StatusBar1.Panels[1].Text := 'Updating...';
lBookmark := DataModule1.SQLQuery1.Bookmark;
DataModule1.SQLQuery1.DisableControls;
DataModule1.SQLQuery1.Close;
DataModule1.SQLQuery1.Open;
DataModule1.SQLQuery1.EnableControls;
DataModule1.SQLQuery1.Bookmark := lBookmark; <-- Random SIGSEGV
StatusBar1.Panels[1].Text := lOldStatus;
end;