Recent

Author Topic: how to apply update application in 2 computer in runtime?  (Read 2797 times)

iamtheatorres2408

  • New Member
  • *
  • Posts: 23
how to apply update application in 2 computer in runtime?
« on: February 16, 2019, 06:27:19 am »
Good Day,

Im creating an application that will be used by 2 computers, one is for inputting updates and viewing and the other one is for viewing only, i used dbgrid and database in my project, what codes can i use to set that if i input an update to computer1, the shorcut application in computer2 will also be updated in run time..i really need some help on this..thank you very much

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: how to apply update application in 2 computer in runtime?
« Reply #1 on: February 16, 2019, 09:42:42 am »
The classic Update-View-Problem.
Solution 1) Use Firebird as a DB and use its Events
Solution 2): Add Sockets to your App, and after input broadcast a Refresh-Request
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

iamtheatorres2408

  • New Member
  • *
  • Posts: 23
Re: how to apply update application in 2 computer in runtime?
« Reply #2 on: February 18, 2019, 12:45:56 am »
good Day,
          do i have other ways or is there a code that can be used to make my project work without using Firebird?..thank you..

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: how to apply update application in 2 computer in runtime?
« Reply #3 on: February 18, 2019, 11:43:54 am »
Well, you could always use a timer on your "Viewer"-Machine/App to refreshes itself in a defined interval, but i'm not really a friend of this approach
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Focus77

  • New Member
  • *
  • Posts: 25
Re: how to apply update application in 2 computer in runtime?
« Reply #4 on: February 20, 2019, 04:10:33 pm »
Hi every body!

Let me introduce  my method to you!
This example show how to refresh data in a computer once updated from another one in the table 'SALES':
1. Set the transaction at the lowest level (read committed):

Copy/Paste  isc_tpb_read_committed in Transaction.Params:

2.Trigger Definition:
Code: Pascal  [Select][+][-]
  1. SET TERM ^ ;
  2. CREATE TRIGGER TRSALES FOR SALES ACTIVE
  3. AFTER INSERT OR UPDATE OR DELETE POSITION 0
  4. AS
  5. BEGIN
  6. post_event 'TRSALES';
  7. END^
  8. SET TERM ; ^
  9.  

3.FBEventMonitor initialization (set in the data Module 'MDT'):
Default 'registered=False'
Code: Pascal  [Select][+][-]
  1. procedure TMDT.DataModuleCreate(Sender: TObject);
  2.  begin
  3.  FBEventMonitor1.RegisterEvents ;
  4.  FBEventMonitor1.Registered:=True ;
  5.  end;

4.'FBEventMonitor' configuration :
Code: Pascal  [Select][+][-]
  1. procedure TMDT.FBEventMonitor1EventAlert(Sender: TObject; EventName: string;
  2.   EventCount: longint; var CancelAlerts: boolean);
  3. begin  
  4. if EventName='TRSALES' then
  5.  sales.Refresh
  6. end;

5. Data update:
Code: Pascal  [Select][+][-]
  1. procedure TMDT.SalesAfterPost(DataSet: TDataSet);
  2. begin
  3.   Sales.ApplyUpdates(-1) ;
  4.   Transaction.CommitRetaining;
  5. end;

6. Data delete :
Code: Pascal  [Select][+][-]
  1. procedure TMDT.SalesAfterDelete(DataSet: TDataSet);
  2. begin
  3.   Sales.ApplyUpdates(-1) ;
  4.   Transaction.CommitRetaining;
  5. end;

thank you!


« Last Edit: February 21, 2019, 08:53:28 am by Focus77 »
My goal is to make a web Application
using HTTPServer

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: how to apply update application in 2 computer in runtime?
« Reply #5 on: February 21, 2019, 12:16:37 pm »
Hi every body!

Let me introduce  my method to you!
This example show how to refresh data in a computer once updated from another one in the table 'SALES':
1. Set the transaction at the lowest level (read committed):

Copy/Paste  isc_tpb_read_committed in Transaction.Params:

*snipp*

3.FBEventMonitor initialization (set in the data Module 'MDT'):
*snipp*
4.'FBEventMonitor' configuration :
*snippsnipp*
 
thank you!

Your point?
Quote
good Day,
          do i have other ways or is there a code that can be used to make my project work without using Firebird?..thank you..
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Focus77

  • New Member
  • *
  • Posts: 25
Re: how to apply update application in 2 computer in runtime?
« Reply #6 on: February 21, 2019, 12:54:51 pm »
Hello !

@Zvoni
Quote
good Day,
          do i have other ways or is there a code that can be used to make my project work without using Firebird?..thank you..

In fact I didn't see this, I'm sorry!  :-[
My goal is to make a web Application
using HTTPServer

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: how to apply update application in 2 computer in runtime?
« Reply #7 on: February 22, 2019, 07:30:56 pm »
Good Day,

Im creating an application that will be used by 2 computers, one is for inputting updates and viewing and the other one is for viewing only, i used dbgrid and database in my project, what codes can i use to set that if i input an update to computer1, the shorcut application in computer2 will also be updated in run time..i really need some help on this..thank you very much

Question: By any chance, are you using SQLite3?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

 

TinyPortal © 2005-2018