Dataset not binding to afterOpen event on Dataset

I have a TWebClientConnection and TWebClientDataset combo that is set to autoopen = true, though when i look in the console the event is not triggered:

unit Login;

interface

uses
  System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
  WEBLib.Forms,WEBLib.REST, WEBLib.Dialogs, Vcl.StdCtrls,WEBLib.Cookies, System.DateUtils, WEBLib.StdCtrls, Vcl.Controls, WEBLib.CDS, Data.DB;

type
  TForm5 = class(TWebForm)
    Username: TWebLabel;
    Login: TWebButton;
    cu_username: TWebEdit;
    cu_password: TWebEdit;
    Password: TWebLabel;
    ConnectionLogin: TWebClientConnection;
    LoginDataset: TWebClientDataSet;
    TestDataset: TWebClientDataSet;
    ConnectionTest: TWebClientConnection;
    procedure ConnectionLoginBeforeConnect(Sender: TObject);
    procedure LoginClick(Sender: TObject);
    procedure TestDatasetAfterOpen(DataSet: TDataSet);
    procedure LoginDatasetAfterOpen(DataSet: TDataSet);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form5: TForm5;

implementation
procedure SetCookie(cookie_name, value: String; minutes: UInt64);
var
  Cookies: TCookies;
begin
  Cookies := TCookies.Create;
  Try
    Cookies.Add(cookie_name,value, IncMinute(Now,minutes));
    Cookies.SetCookies;
  Finally
    Cookies.Free;
  End;
end;


{$R *.dfm}

procedure TForm5.ConnectionLoginBeforeConnect(Sender: TObject);
begin
  ConnectionLogin.URI := Format('http://localhost:2001/tms/xdata/CrmService/Login?userid=%s&password=%s', [cu_username.Text,cu_password.Text]);
end;

procedure TForm5.LoginClick(Sender: TObject);
begin
WriteLn('jesus');
ConnectionLogin.AutoOpenDataSet := True;
ConnectionLogin.Active := True;
LoginDataset.Open;
WriteLn(ConnectionLogin.AutoOpenDataSet);
WriteLn(ConnectionLogin.Active);
end;

procedure TForm5.LoginDatasetAfterOpen(DataSet: TDataSet);
begin
WriteLn('opened dataset');
LoginDataset.First;
if Assigned(LoginDataset.FieldByName('value')) then
begin
WriteLn('set cookie');
 SetCookie('bearer',LoginDataset.FieldByName('value').Text,100);
 WriteLn('set cookie2');
end;
end;

procedure TForm5.TestDatasetAfterOpen(DataSet: TDataSet);
begin
WriteLn('finished');
end;

end.

Is this the latest version of TMS WEB Core as in older versions there was this shortcoming.

This is Delphi 11.2

I asked if it is the latest version of TMS WEB Core, v2.5.4.0

We are using 2.1.0.2

So please use the latest version as I said already: "as in older versions there was this shortcoming"

After update to the latest version of TMS Web Core, im getting this error message:
image

It's impossible to say anything useful with just this error message.
How can we reproduce a problem?
Did you test demos first? New app? ....

So basically i have this wrapper that contains the header of the page and a WebPanel that i can replace the form i want into which worked perfectly before updating:

unit Wrapper;

interface

uses
  System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
  WEBLib.Forms, WEBLib.Dialogs, Vcl.Menus, WEBLib.Menus,WEBLib.WebTools, Vcl.Controls, WEBLib.ExtCtrls,
  Customer, Main, Inventory, Login,WEBLib.Cookies, System.DateUtils,
  MainInsert, Help;

type
  TForm3 = class(TWebForm)
    WebMainMenu1: TWebMainMenu;
    Customer1: TMenuItem;
    WebPanel1: TWebPanel;
    Main1: TMenuItem;
    Inventory1: TMenuItem;
    MainUpdate1: TMenuItem;
    procedure setActiveForm(Sender: TObject);
    procedure Main1Click(Sender: TObject);
    procedure Main2Click(Sender: TObject);
    procedure Inventory1Click(Sender: TObject);
    function isLoggedIn(): Boolean;
  private
  public
    bearerToken: string;
    targetCustomerId: Integer;
    targetCompanyId: Integer;
  end;

var
  Form3: TForm3;
  frm: TWebForm;

implementation

{$R *.dfm}
function TForm3.isLoggedIn(): Boolean;
begin
  Form3.bearerToken := DataModule1.GetCookie('bearer');
  Result := Form3.bearerToken <> '';
end;

procedure TForm3.Inventory1Click(Sender: TObject);
var i: Integer;
compId:string;
custId:string;
begin
compId := GetQueryParam('co001comp');
custId := GetQueryParam('cu001idno');
if Assigned(frm) then
begin
frm.Free;
end;
 if custId.IsEmpty() and not isLoggedIn() then
 begin
//Open Customer list
 Application.CreateForm(TForm5,WebPanel1.ElementID, frm);
 end
 else
 begin
//Open Customer details
 Application.CreateForm(TForm4,WebPanel1.ElementID,frm);
 end;
end;

procedure TForm3.Main1Click(Sender: TObject);
var i: Integer;
compId:string;
custId:string;
begin
compId := GetQueryParam('co001comp');
custId := GetQueryParam('cu001idno');
if Assigned(frm) then
begin
frm.Free;
end;

 if custId.IsEmpty() and not isLoggedIn() then
 begin
//Open Customer list
 Application.CreateForm(TForm5,WebPanel1.ElementID, frm);
 end
 else
 begin
//Open Customer details
 Application.CreateForm(TForm1,WebPanel1.ElementID,frm);
 end;
end;
procedure TForm3.Main2Click(Sender: TObject);
var i: Integer;
compId:string;
custId:string;
begin
WriteLn('Entered');
compId := GetQueryParam('co001comp');
custId := GetQueryParam('cu001idno');
if Assigned(frm) then
begin
frm.Free;
end;

 //if custId.IsEmpty() and not isLoggedIn() then
 //begin
//Open Customer list
 //Application.CreateForm(TForm5,WebPanel1.ElementID, frm);
 //end
 //else
 //begin
//Open Customer details
 Application.CreateForm(TForm6,WebPanel1.ElementID,frm);
 //end;
end;

procedure TForm3.setActiveForm(Sender: TObject);
var i: Integer;
compId:string;
custId:string;
begin
compId := GetQueryParam('co001comp');
custId := GetQueryParam('cu001idno');

if Assigned(frm) then
begin
frm.Free;
end;
 if custId.IsEmpty() and not isLoggedIn() then
 begin
 WriteLn('Login');
//Open Customer list
Application.CreateForm(TForm5,WebPanel1.ElementID, frm);
 end
 else
 begin
 WriteLn('Customer details');
//Open Customer details
 Application.CreateForm(TForm1,WebPanel1.ElementID,frm);
 end;
end;

end.

this is my source file for the project:

program ProXERP_Web;

uses
  Vcl.Forms,
  WEBLib.Forms,
  Main in 'Main.pas' {Form1: TWebForm} {*.html},
  Customer in 'Customer.pas' {Form2: TWebForm} {*.html},
  Wrapper in 'Wrapper.pas' {Form3: TWebForm} {*.html},
  Inventory in 'Inventory.pas' {Form4: TWebForm} {*.html},
  Login in 'Login.pas' {Form5: TWebForm} {*.html},
  MainInsert in 'MainInsert.pas' {Form6: TWebForm} {*.html},
  Help in 'Help.pas' {DataModule1: TDataModule};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm3, Form3);
  Application.CreateForm(TForm4, Form4);
  Application.CreateForm(TForm5, Form5);
  Application.CreateForm(TForm6, Form6);
  Application.CreateForm(TDataModule1, DataModule1);
  Application.Run;
end.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

I"m very sorry but with such partial information, there is a little I can do to reproduce & investigate this here