#1 Re: mORMot 1 » Error TSQLRestClientHTTP to connect to Remote Rest Server via HTTP » 2017-11-24 12:54:46

I already remove SynCrossPlatformRest, but  found error [dcc32 Error] Unit3.pas(30): E2003 Undeclared identifier: 'TSQLRestClientHTTP'.

Thats why i remove SynCommons and mORMot and used SynCrossPlatformRest again. I got mORMot from github

#2 Re: mORMot 1 » Error TSQLRestClientHTTP to connect to Remote Rest Server via HTTP » 2017-11-24 09:39:01

Oh, sorry about that,
First time i using SynCommons/mORMot and CrossPlatform, but after error i delete SynCommons/mORMot and only using CrossPlatform, but error still exists, confuse where i miss

#3 Re: mORMot 1 » Error TSQLRestClientHTTP to connect to Remote Rest Server via HTTP » 2017-11-24 09:05:30

Yes ab,  I know that TSQLKaryawan should inherit from TSQLRecord
my class code like

TSQLKaryawan = class(TSQLRecord)
  protected
    fCenter: RawUTF8;
 ...

but i dont understand is why I got error [dcc32 Error] Unit3.pas(49): E2010 Incompatible types: 'TSQLRecordClass' and 'class of TSQLKaryawan'
when coding fClientModel:=TSQLModel.Create([TSQLKaryawan,TSQLKeluarga],'root');
You suggest it's compiler error?

#4 Re: mORMot 1 » Error TSQLRestClientHTTP to connect to Remote Rest Server via HTTP » 2017-11-24 08:52:47

Dear ab, thanks for fast reply.

Did you have suggestion to resolve? Iam using XE10.2 Lite

#5 mORMot 1 » Error TSQLRestClientHTTP to connect to Remote Rest Server via HTTP » 2017-11-24 04:20:43

fadhilah
Replies: 9

Dear all,

First time trying mormot and try to connect to TSQLHttpServer remotely with code

Var
  I: Integer;
  fClientRest:TSQLRestClientHTTP;
  fClientModel: TSQLModel;
  fKaryawan: TSQLKaryawan;
begin
  fClientModel:=TSQLModel.Create([TSQLKaryawan,TSQLKeluarga],'root');
  fClientRest:=TSQLRestClientHttp.Create('localhost',8080,fClientModel);
  try
    if fClientRest.Connect then begin
       Showmessage('Connect');
      fKaryawan:= TSQLKaryawan.CreateAndFillPrepare(fClientRest,'','');
       Showmessage('fKaryawan Filled');
    end
    else
      Button1.Enabled := false;
  except
    on E: Exception do raise
  end;
end;

but got error : [dcc32 Error] Unit3.pas(49): E2010 Incompatible types: 'TSQLRecordClass' and 'class of TSQLKaryawan'
at line   fClientModel:=TSQLModel.Create([TSQLKaryawan,TSQLKeluarga],'root');

but when TSQLModel change to
fClientModel:=TSQLModel.Create([TSQLRecordClass(TSQLKaryawan),TSQLRecordClass(TSQLKeluarga)],'root');
and error changes to
[dcc32 Error] Unit3.pas(56): E2250 There is no overloaded version of 'CreateAndFillPrepare' that can be called with these arguments
at line   fKaryawan:= TSQLKaryawan.CreateAndFillPrepare(fClientRest,'','');

and then I change TSQLKaryawan.CreateAndFillPrepare to
fKaryawan:= TSQLKaryawan(TSQLRecordClass.CreateAndFillPrepare(fClientRest,'','',[]));
but compilled but when running show error
"Project TestRestClient_httpServer.exe raised exception class ERestException with message 'TSQLRecord should be part of the Model'."

Did anybody can help to solve whats wrong with my code?

Board footer

Powered by FluxBB