Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TDataSet from Rest Server returns empty data


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Jun 23, 2014 2:50 AM Last Post By: Jason Sweby Threads: [ Previous | Next ]
Lasse Laegteskov

Posts: 1
Registered: 12/11/07
TDataSet from Rest Server returns empty data  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 19, 2014 6:18 AM
Hi I'm using Delphi XE5 and a REST Server to get data from a server.

If I return a TDataSet from a REST-server like this:
function TServerMethods1.GetDataSet : TDataSet;
begin
  OpenSQLConnection; // Opens connection to database
  SQLDataSet.CommandText:='select * from eqsproject where 1=2';
  SQLDataSet.Open;
  result:=SQLDataSet;
end;


and the recordset is empty I can see that data returned from the server is this (using the browser and checking the methods):

Executed:	TServerMethods1.GetDataSet
Result:	{"result":{"table":[]}}


it's a very big problem because I use this on the client (taking from Marco Cantus blog http://blog.marcocantu.com/blog/remote_rst_dataset_clientdataset.html):

var 
  theDataSet: TDataset; 
begin 
  theDataSet := ClientModule1.ServerMethods1Client.GetDataSet; 
  DataSetProvider1.DataSet := theDataSet; 
  ClientDataSet1.Open;


The call to Open now returns an Access violation because the returned TDataSet is incorrect with no information about fields and I not able to e.g. append data locally and later send to the server.

Isn't this clearly a problem with the DataSnap and how can I solve this problem so the TDataSet just returns an empty dataset with existing field info?

Thanks

Lasse
Jason Sweby

Posts: 46
Registered: 5/20/00
Re: TDataSet from Rest Server returns empty data  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 23, 2014 2:50 AM   in response to: Lasse Laegteskov in response to: Lasse Laegteskov
Lasse Laegteskov wrote:
Isn't this clearly a problem with the DataSnap and how can I solve this problem so the TDataSet just returns an empty dataset with existing field info?

Hi Lasse,

I'm having the same issue, but not from every instance of the Web Service. If I run it locally, Datasnap returns a full result set. IF I run it on a remote server elsewhere (but pointing at the same database), it returns an empty result set.

{"result":[{"table":[]}]}


Did you ever get anywhere with this?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02