Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
246 views
in Technique[技术] by (71.8m points)

delphi - how to return TByteDynArray in SqlServerMethod DataSnap Server

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...