how to return TByteDynArray in SqlServerMethod DataSnap Server

我的未来我决定 提交于 2019-12-13 08:26:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!