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

Howard Lee Harkness howard.lee.harkness at gmail.com
Sun Jun 22 23:04:48 CEST 2008


Ok I added the Post call (for some reason, I thought the DbNavigator did
that automatically, but apparently not if you implement the click handler.
So now I have:

procedure TForm1.DBNavigator1Click(Sender: TObject; Button:
TDBNavButtonType);
begin
  case Button of
  nbEdit: begin
          SQLQuery1.Edit;
          end;
  nbPost: begin
          SQLQuery1.Post;
          SQLQuery1.DisableControls;
          SQLQuery1.ApplyUpdates;
          SQLQuery1.EnableControls;
          end;
  nbRefresh: begin
             SQLQuery1.Close;
             SQLQuery1.Open;
             end;
  end;
end;

Inch by incredible inch. I can now insert and delete, but edit still does
nothing, even though it appears to until I stop and restart the program.

On Sun, Jun 22, 2008 at 1:22 PM, Howard Lee Harkness <
howard.lee.harkness at gmail.com> wrote:

> On Sun, Jun 22, 2008 at 9:03 AM, Joost van der Sluis <joost at cnoc.nl>
> wrote:
>
>> My question is why you did DBNavigator1Click at all? On nbPost, it
>> should call - first of all - SQLQuery1.Post. You forgot that. (I guess
>> that that's your edit-problem) Normally, if you don't implement
>> DBNavigator1Click it will do that automatically.
>>
>> Well, without some place to put the ApplyUpdates call, nothing gets
> changed in the database. When I tried not implementing the
> DBNavigator1Click, the program appeared to be working, but the database
> never actually changed.
>
> I also tried putting the ApplyUpdates in the FormClose event, and that
> didn't do anything, either.
>
> You are the one that mentioned that I needed to call ApplyUpdates (and
> later, disable and enable controls). Could you please take a look at the
> code I posted and SHOW ME what I need to do to make this work?
> --
> Howard Lee Harkness
>



-- 
Howard Lee Harkness
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20080622/3d9dd748/attachment-0007.html>


More information about the Lazarus mailing list