0

I have a DataSnap Server with a Server method like this:

function TServerMethods1.selectFalzUser(Usuario: string) : TDataSet;

Now, on the DataSnap Client using TSQLServerMethod, I successfully connect to the server in Design Mode, pull server's methods list ... select 'selectFalzUser'... and I can succesfully see my params, both Usuario as INput, and the output TDataset Param... when a try to set my SqlServerMethod Active ... I get the following error:

Error Remote error: TServerMethods1.selectFalzUserwhereUsuario method not found in the server method list.

Why Delphi is appending 'whereUsuario' string to the method name? Obviously TServerMethods1.selectFalzUserwhereUsuario does not exist.

Regards

zaguerino.

RRUZ
  • 134,889
  • 20
  • 356
  • 483
Jorge Ramirez
  • 81
  • 3
  • 3
  • TDataSet is not a type you can return in a DataSnap remote function call. Un saludo.! – jachguate Aug 06 '12 at 23:41
  • Hi , I was reading Bob Swart's White Paper: "Delphi 2010 DataSnap: Your data where you want it, how you want it", where it shows a Server Method named: function TServerMethods1.GetEmployees: TDataSet; What would be the correct type to return rows in a server method? Regards Zaguerinho – Jorge Ramirez Aug 07 '12 at 02:28

1 Answers1

0

Without seeing more code it is hard to say why it isn't reporting the method name correctly. However, it doesn't sound like you are using DataSnap quite right. Here is what I have done successfully for several projects:

You must include {$METHODINFO ON} before the TServerMethods class definition and {$METHODINFO OFF} after the class definition in the DataSnap server. Then compile and run your DS server.

On the client side, add a TSQLConnection component and set its properties to connect to your listing DS server. Then right click the TSQLConnection and select Generate DataSnap client classes. Save this as something like ProxyMethods.pas and include it in your client project. Then you can access the ProxyMethods class to call any of the published TServerMethods in the server.

Also, returning TDataSet won't work with the approach I described because TDataSet is not a marshallable datatype, however OleVariant is. I have had good success with returning a TClientDataSet.Data, and then on the client side I can assign this directly the Data property of a client-side TClientDataSet.

James L.
  • 9,384
  • 5
  • 38
  • 77
  • Thank you, I added the directives but still same error. I had to create a server method exactly as the name it was complaining then call the original method name inside very weird and it worked, but doesn't seem right. – Jorge Ramirez Aug 06 '12 at 22:16
  • 1
    I agree, that doesn't seem right. You might revise your question and describe the process you used (in detail) to create both the client and the server. There are several DataSnap gurus on SO that could help identify the issue. – James L. Aug 06 '12 at 22:37