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;

--
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 (011) 40871877

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to