问题
I have a DataSnap Server with a Server method like this:
function TServerMethods1.Get_Excel_History(key: string): TByteDynArray;
Now, on the DataSnap Client using TSQLServerMethod, I successfully connect to the server in Design Mode, and I'm sending the request to Server and successfully receiver the data but can not read the output parameter.
M.SqlServerMethod1.Close;
M.ClientDataSet_All.Close;
M.SqlServerMethod1.ServerMethodName:='TServerMethods1.Get_XML_History';
M.SqlServerMethod1.Params.ParamByName('key').Value:=Edit1.Text;
M.SqlServerMethod1.ExecuteMethod;
ByteDynArray_Result:=M.SqlServerMethod1.Params.ParamByName('ReturnParameter').As???????;
How can i read the type of TByteDynArray? Thank you in advance.
回答1:
TByteDynArray is not a valid DataSnap parameter. The list of allowed parameter types depends on the Delphi version and is documented here: Exposing DataSnap Server Methods. For Delphi 10.2 Tokyo this is:
Boolean
SmallInt
Integer
Int64
Single
Double
AnsiString
String
TDBXTime
TDBXDate
TJSONValue and all descendents
TDBXWideStringValue
TDBXAnsiStringValue
TDBXUInt8Value
TDBXInt8Value
TDBXInt16Value
TDBXInt32Value
TDBXInt64Value
TDBXSingleValue
TDBXDoubleValue
TDBXBcdValue
TDBXTimeValue
TDBXDateValue
TDBXTimeStampValue
TDBXBooleanValue
TDBXReaderValue
TDBXStreamValue
A valid alternative could be stream or JSON.
来源:https://stackoverflow.com/questions/51376723/how-to-return-tbytedynarray-in-sqlservermethod-datasnap-server