Topic: MySQL new record not visible to users.

Hello everybody.
I have a medical application distributed to many users.
I am using MySQL.
Only I can register a new patient.
When I register the patient in the database I would like the user to be able to view the new record as well, but that does not happen.
Only when the application is restarted.
How do I get users to access the new record without restarting the application?
Thanks.

2 (edited by Wood 2021-03-26 13:16:54)

Re: MySQL new record not visible to users.

Hi Lejoso

You can use a button with a short script like   Form1.Tablegrid1.dbUpdate;
or you can implement a timer. See example here:   http://myvisualdatabase.com/forum/viewtopic.php?id=7384  or 
you can search the forum for other solutions too [ like I did... wink ]

Regards
Wood

Re: MySQL new record not visible to users.

Hello Wood.

I tried as you suggested but I still haven't been successful.
Something is not right.
Still very grateful.

Re: MySQL new record not visible to users.

Hello Lejoso,


If you are updating a tablegrid you could do the following.

procedure dbUpdateTimer;
var
    indx,cnt : integer;
begin
  {updates any tablegrid no matter what its name onfrmMain}
  cnt := frmMain.ComponentCount -1;
  for indx := 0 to cnt do
  begin
    if frmMain.Components[indx]  is TdbStringGridEx then
        TdbStringGridEx(frmMain.Components[indx]).dbUpdate;
  end;    
{end of frmMain updates}

{manually update other forms}                                                                                          
  frmOrderEntry.grdOrder.dbUpdate;
  frmEditAssemblies.tgMasterPart.dbUpdate;
  frmEditAssemblies.tgSubPart.dbUpdate;
  frmEditPart.grdEditPart.dbUpdate;
{end of manual update other forms}
  //showmessage('databases updated');
end;

This code automatically updates all tablegrids in the program every 30 seconds or so. The timer is set up elsewhere.

If you don't want to do that, all you need to do is add the line

FormName.TableGridName.dbUpdate

in an event such as after_click  etc.

On a clear disk you can seek forever

Re: MySQL new record not visible to users.

Thank you very much CDB
As soon as I have a result I will inform you.