[Lazarus] [lazarus] Advice about creating database-aware application with Lazarus

Joost van der Sluis joost at cnoc.nl
Thu Jun 19 15:25:16 CEST 2008


Op zaterdag 14-06-2008 om 19:16 uur [tijdzone -0500], schreef Howard Lee
Harkness:
> Did you ever get an answer to this question? I am having a similar
> difficulty, and information on ApplyUpdates is infuriatingly hard to
> find.

You can find this problem in the bug-tracker. You can work around it
with 'TDataset.DisableControls' and 'TDataset.Enablecontrols' around the
applyupdates call. Or try fpc 2.2.2rc1 or any later version.

Joost.

> On Tue, Oct 10, 2006 at 1:11 AM, Adrian Maier <adrian.maier at gmail.com>
> wrote:
>         On 10/10/06, Joost van der Sluis <joost at cnoc.nl> wrote:
>                 
>                 Well... As I read it, that's not the problem. All
>                 changes are made in an
>                 update-buffer first. So if you do a 'delete' in the
>                 grid, the records
>                 get deleted in that buffer. Thus the record should
>                 disapear immediately
>                 in the grid. But not yet on the database.
>                 
>                 The 'delete'-sql is only send to the database on
>                 the .applyupdates
>                 command. And committed on the .commitretaining. Thus
>                 that can happen
>                 much later. (on the click on the 'save' button)
>                 
>                 But if I understood you correctly, the delete fails
>                 immediately. That
>                 means that there's a problem in the deletion of
>                 records in a grid. Or in
>                 the .delete from Tbufdataset. You first have to test
>                 that. Easiest way
>                 is to add a button 'delete' which does
>                 sqlquery1.delete. That'll delete
>                 the current record, and it should be immediately
>                 visible in the grid.
>                 Else you could do a .refresh after the .delete, to be
>                 sure that the grid
>                 gets refreshed. (If not, it's a bug, btw)
>         
>         
>         I've added a button which calls query1.Delete.  The row
>         disappears
>         from the grid now.     So, it looks like TdbNavigator's
>         "Delete" button does
>         something different than it's supposed to do ?
>         
>         However, when I press "Save" (which does applyupdates and
>         commitretaining)
>         the program crashes with  :
>         
>         TApplication.HandleException Access violation
>          Stack trace:
>          $08211A8E
>          $0821AE3F  TCUSTOMDBGRID__UPDATESCROLLBARRANGE,  line 1336 of
>         dbgrids.pas
>          $0821B013  TCUSTOMDBGRID__DOLAYOUTCHANGED,  line 1402 of
>         dbgrids.pas
>          $0821CB35  TCUSTOMDBGRID__ENDLAYOUT,  line 2164 of
>         dbgrids.pas
>          $0821B660  TCUSTOMDBGRID__LAYOUTCHANGED,  line 1568 of
>         dbgrids.pas
>          $08219DA2  TCUSTOMDBGRID__ONDATASETCHANGED,  line 814 of
>         dbgrids.pas
>          $0821E518  TCOMPONENTDATALINK__DATASETCHANGED,  line 2722 of
>         dbgrids.pas
>          $0820E0F4
>          $0820EEF5
>          $0820F10B
>          $08202E6B
>          $08205F5D
>          $08211320
>          $08211264
>          $0807DE10  TFORMASIMPLA__ACTIONCOMMITEXECUTE,  line 85 of
>         forma_simpla.pas
>          $0808DDB5
>          $081755F2  TCONTAINEDACTION__EXECUTE,  line 110 of
>         ./include/containedaction.inc
>         
>         In ContainedAction.inc:
>         
>         function TContainedAction.Execute: Boolean;
>         begin
>          Result := (ActionList <> nil) and
>         ActionList.ExecuteAction(Self)
>           or ((ApplicationActionComponent<>nil)
>                and ApplicationActionComponent.ExecuteAction(Self))
>           or inherited Execute                         //
>         <------------------------- line 110
>           or (SendApplicationMessage(CM_ACTIONEXECUTE, 0,
>         PtrInt(Self)) = 1);
>         end;
>         
>         
>         Cheers,
>         Adrian Maier
>         
>         
>         
>         _________________________________________________________________
>            To unsubscribe: mail lazarus-request at miraclec.com with
>                       "unsubscribe" as the Subject
>          archives at http://www.lazarus.freepascal.org/mailarchives
>         
> 
> 
> 
> -- 
> Howard Lee Harkness
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
-- 




More information about the Lazarus mailing list