Rather important thing in Web server application lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- egsuh · 2020-05-25 08:32 I'm not quite sure about what I'm trying to talk now, but based on many experimentation, I have following conclusion. In web-server application, you have to avoide using global-scope variables. You can have more than one datamodules (including webmodule) in Lazarus, which is not allowed in Delphi (at least up to Delphi 7). Let's assume that you have one webmodule and one normat datamodule and the latter has database connections and related methods operating on the database. I listed up structure normally created, but think that the variable of the datamodule must be declared within web-module, as explained in the comments.  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit wm_unit; interface uses dm_unit;   type     Twm1 = class(TFPWebModule)           .......     private        wdm1 : Tdm1; // You have to define the variable here.     end;  var   wm1: Twm1;  // Actually this variable seems never used.   implementation    ..... procedure Twm1.DataModuleCreate(Sender: TObject);begin     wdm1 := Tdm1.Create(Self);         // And Created hereend;  procedure Twm1.DataModuleDestroy (Sender: TObject);begin      wdm1.Free;    // Freed here. But I think this is not necessary as it is owned by Self. end;  initialization    RegisterHTTPModule('wm1', Twm!);end.  // ----------------------- Data Module  unit dm_unit; interface  type   Tdm1 = class(TDataModule)           .......    end;  var   dm1: Tdm!;          // this variable SHOULD NOT be used. implementation    .....end.   Please anyone advise me if I'm wrong. ---------------------------------------------------------------------- Thaddy · 2020-05-25 08:47 I seriously advice you to play "Oh, well" Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var   dm1: Tdm!;            // this variable SHOULD NOT be used. As is the exclamation mark...................................................... ................... Writing invalid code is easy.