title: DataSnap return empty dataset
body: <p>After more than a week's trial, I feel very depressed with DataSnap.</p>
  
  <p>Today I again encountered a problem,</p>
  
  <p>My Android(Java) client need to get a dataset from the DataSnap Server(XE6)，but the server return a empty result:</p>
  
  <blockquote>
    <p>{"result":[{"table":[]}]}</p>
  </blockquote>
  
  <p>Here is the server code:</p>
  
  <pre><code>function TServerMethods1.GetDataset(cmdstr: string): TDBXReader;
  var
    CMD: TDBXCommand;
  begin
    SQLConnection1.Open;
    CMD := SQLConnection1.DBXConnection.CreateCommand;
    CMD.CommandType := TDBXCommandTypes.DbxSQL;
    CMD.Text := cmdstr;
    if not CMD.IsPrepared then
      CMD.Prepare;
  
    Result := CMD.ExecuteQuery;
  
    CMD.Free;  // If this line is commented out, it will memory leaks and return an exception.
  end;
  </code></pre>
  
  <p><strong>[Update-----------------]</strong></p>
  
  <p>Today I changed db access components to FireDAC:</p>
  
  <pre><code>{$METHODINFO ON}
    TServerMethods1 = class(TDataModule)
      Sqlite_demoConnection: TFDConnection;
      FDQuery1: TFDQuery;
      FDGUIxWaitCursor1: TFDGUIxWaitCursor;
      FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink;
    private
      { Private declarations }
    public
      { Public declarations }
      function EchoString(Value: string): string;
      function ReverseString(Value: string): string;
      function GetDataSet: TDataset;
    end;
  {$METHODINFO OFF}
  
  
  function TServerMethods1.GetDataSet: TDataset;
  begin
    FDQuery1.SQL.Clear;
    FDQuery1.SQL.Text := 'select EmployeeID, LastName, FirstName, BirthDate from Employees';
    FDQuery1.Open();
    Result := FDQuery1;
  end;
  </code></pre>
  
  <p>Delphi client can get the result and parse it. But Java client(Android) can't parse the result:</p>
  
  <pre><code>DSRESTConnection aConn = new DSRESTConnection();
  DSProxy.TServerMethods1 aProxy = new DSProxy.TServerMethods1(conn);
  aConn.setHost("192.168.0.240");
  aConn.setPort(8080);
  aConn.setProtocol("http");
  try {
      TDataSet rd = aProxy.GetDataSet();
  
      int FieldCount = rd.getColumns().size();
      Log.i("FieldCount：", String.valueOf(FieldCount));  // get 4
  
      //rd.reset();
      while (rd.next())  // rd.next() get exception and return false
      {  
          Log.i("EmployeeID", rd.getValue("EmployeeID").GetAsString());
          Log.i("LastName", rd.getValue("LastName").GetAsString());
  
      }
  } catch (DBXException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p><strong>Update 2-------------------</strong></p>
  
  <p>OK, I can got the result. Thank you MartynA and J__. </p>
  
  <p>and I found why <strong>rd.next()</strong> return false:</p>
  
  <p>The dataset which return from server, include a <strong>datetime field</strong>. DataSnap transform it to json:</p>
  
  <pre><code>"BirthDate":["1948-12-08.0","1952-02-19.0","1963-08-30.0"]
  </code></pre>
  
  <p>Every date value append with a ".0" tail.
  So, Java can't transform back to Date type:</p>
  
  <pre><code>com.embarcadero.javaandroid.DBXException: Unparseable date: "1948-12-08.0" (at offset 10)
  </code></pre>
  
  <p>Then, I add a new server method to test return TDateTime type:</p>
  
  <pre><code>function TServerMethods1.GetDateTime: TDateTime;
  begin
    Result := int(Now);
  end;
  </code></pre>
  
  <p>DataSnap also put it into the style below:</p>
  
  <pre><code>{"result":["2014-06-27.0"]}
  </code></pre>
  
  <p>Ooh, My god. How to fix this? on Server side? on Client side? </p>