Home > Back-end >  Datasnap error: Remote error VAR and OUT the arguments must match the parameter type exactly
Datasnap error: Remote error VAR and OUT the arguments must match the parameter type exactly

Time:09-19

Server:
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The function TServerMethods1. OpenSQL_ole1 (Asql: WideString; The out ret: olevariant) : Boolean;
The begin
With ADOQuery1 do
The begin
Close;
sql.Clear;
SQL. Text:=Asql;
Ret:=true;
Ret:=DataSetProvider1. Data;
end;
end;

Client:
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Var
Aa: TServerMethods1Client;
Bb: OleVariant;
A1, a2: WideString;
C, I: integer;
D: Boolean;
The begin
Aa:=TServerMethods1Client. Create (ClientModule1. SQLConnection1. DBXConnection);
ClientDataSet1. Close;
A1:='select * from employe';
D:=aa openSQL_ole1 (a1, bb);
ClientDataSet1. Data:=bb;
Sleep (50);
StatusBar1. Panels. The Items [0]. Text:=IntToStr (I);
Aa. Free
end;

The function TServerMethods1Client. OpenSQL_ole1 (Asql: WideString; The out ret: olevariant) : Boolean;
The begin
If FopenSQL_ole1Command=nil then
The begin
FopenSQL_ole1Command:=FDBXConnection. CreateCommand;
FopenSQL_ole1Command.Com mandType:=TDBXCommandTypes. DSServerMethod;
FopenSQL_ole1Command. Text:='TServerMethods1. OpenSQL_ole1';
FopenSQL_ole1Command. Prepare;
end;
FopenSQL_ole1Command. The Parameters [0]. Value. SetWideString (Asql);
FopenSQL_ole1Command. ExecuteUpdate;
Ret:=FopenSQL_ole1Command Parameters. [1] Value. AsVariant;
Result:=FopenSQL_ole1Command Parameters. [2] Value. GetBoolean;
end;

client perform error: Remote error: VAR and OUT the arguments must match the parameter type exactly
Change out to VAR is an error,
Put out ret: olevariant with out ret: integer return olevariant is not an error,

The great spirit show just a little

CodePudding user response:

Remote error VAR and OUT the arguments must match the parameter type exactly
Remote data transmission error, VAR and parameters must match exactly the type

Try this:
//the server
The function TServerMethods1. OpenSQL_ole1 (const Asql: WideString; The out ret: olevariant) : Boolean;

//client
Var: SQL string;
Bb: Boolean;

D:=aa openSQL_ole1 (SQL, bb);

CodePudding user response:

No, at the same fault again

CodePudding user response:

The same problem, you

CodePudding user response:

Problem solved?

CodePudding user response:

I also met the same problem, the same code in DELPHI XE4 running under no problem completely,
But in 10.1 RAD (compiled under the runtime, appears
Remote error: VAR and OUT the arguments must match the parameter type exactly.

With SqlServerMethod1 do
The begin
Close;
ServerMethodName:=';
Params. The Clear;
ServerMethodName:='TDSDBSave. ParamTest';
Prepared:=True;
Params [0]. AsString:='test';
//the following Params [1]. The value is the Variant type, Delta is OleVariant type, suspected causes of parameters does not match!!!!!
Params [1]. The Value:=cdsMaster. Delta;
ExecuteMethod;//execution to the trigger exceptions: Remote error: VAR and OUT the arguments must match the parameter type exactly.
Close;
end;

CodePudding user response:

 function TServerMethods1. OpenSQL_ole1 (Asql: WideString; The out ret: olevariant) : Boolean; 
The begin
result:=false;
With ADOQuery1 do
The begin
Close;
sql.Clear;
SQL. Text:=Asql;

Ret:=DataSetProvider1. Data;
Result:=true;
end;
end;

CodePudding user response:

I also met, I found DX10.1 Berlin Datasnap parameter is OleVariant type is defined as the var or out when out this problem.

CodePudding user response:

Is there a solution to this problem the original poster? How to solve?
  • Related