Question

I wish to be able to declare a Data Snap method with the following signature

type
  TLoginInfo = record
    Username: string;
    Password: string;
    LastLogged: DateTime;
  end;

function GetLoginInfo(const UserId: Integer): TLoginInfo;

When I try to call it it says that TLoginInfo is not well known.

OTHER TIPS

store the record into a stream and pass the stream to the DataSnap method

//on server side

function GetLoginInfo(const UserId: Integer): TStream;
begin
  Result := TMemoryStream.Create;
  Result.Write( loginRec, SizeOf(TLoginInfo) )
  Result.Seek(0, TSeekOrigin.soBeginning);
end;

//on client side

procedure TfrmMain.getLogInto( sUser: string);
var
  AStr : TStream;
  loginRec : TLoginInfo;
begin
//  cycleConnection;

  with TMethodsClient.Create( SQLConn.DBXConnection, False ) do begin

    AStr := GetLoginInfo( sUser );
    AStr.Read( loginRec, SizeOf(TLoginInfo) )
    Free;
  end;

  FreeAndNil(AStr);
end;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top