Jump to content

How to perform a query in my background bank?


eduardosuruagy

Recommended Posts

32 minutes ago, Hayri ASLAN said:

Antes da consulta, você pode chamar showmask e sincronizar. No final da consulta, você pode chamar hide mask

I did so, put a UniTimer in my MainForm, when I enter my MainForm I activate my UniTimer in the MainForm.UniFormActivate event.

Inside UniTimer I make my select and update some information on the screen. But I realize that my screen freezes for a while even the SQL command inside UniTimer. This way I made this correct?

Link to comment
Share on other sites

20 minutes ago, eduardosuruagy said:

Inside UniTimer I make my select and update some information on the screen. But I realize that my screen freezes for a while even the SQL command inside UniTimer. This way I made this correct?

Please see this demo:

\FMSoft\Framework\uniGUI\Demos\Desktop\ThreadTimer-2

 

Link to comment
Share on other sites

On 28/12/2019 at 12:42, Sherzod said:

Por favor, veja esta demonstração:


 

Using the example you indicated I made a change, I put UniThreadTimer1 in MainForm, but it crashes when trying to access some information from UniMainModule. How can I access a variable that is in UniMainModule?

 

procedure TMainForm.UniThreadTimer1Timer(Sender: TObject);
var
  FS : TUniGUISession;
  B : TBookmark;
begin
  if Assigned(UniMainModule.UniApplication) then
  begin
    FS := (UniMainModule.UniApplication as TUniGUIApplication).UniSession; // This is the uniSession instance which is the owner of this UniMainModule
    FS.LockSession;   // make sure session is not busy
    try
      B := UniMainModule.ClientDataSet1.GetBookmark;
      try
        UniMainModule.ClientDataSet1.Append;
        UniMainModule.ClientDataSet1.FieldByName('F1').AsInteger := UniMainModule.ClientDataSet1.RecordCount;
        UniMainModule.ClientDataSet1.FieldByName('F2').AsString := TimeToStr(Now);
        UniMainModule.ClientDataSet1.Post;
        UniMainModule.ClientDataSet1.GotoBookmark(B);
      finally
        UniMainModule.ClientDataSet1.FreeBookmark(B);
      end;
    finally
      FS.ReleaseSession;
    end;
  end;
end;
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...