Good afternoon!
I have a problem and I would like to see if you can help me.
I have a DataSnap server, which is working normally. In it, I add and query the database by mobile devices.
In the function where I make the register, it is configured like this ...
function TSM.updateClientes(TObjJSON: TJSONObject): TJSONValue;
var
vCliente: TCliente;
begin
vCliente:=TJson.JsonToObject<TCliente>(TObjJSON.ToJSON);
try
tbUsuarios.Open;
if not (tbUsuarios.Locate('email', vCliente.Email,[])) then
begin
tbUsuarios.Append;
tbUsuarios.FieldByName('nome').AsString:=vCliente.Nome;
tbUsuarios.FieldByName('email').AsString:=vCliente.Email;
tbUsuarios.FieldByName('login').AsString:='@'+vCliente.Login;
tbUsuarios.FieldByName('senha').AsString:=Encode64(vCliente.Senha, IndyTextEncoding_UTF8);
tbUsuarios.FieldByName('data_cadastro').AsDateTime:=Now;
tbUsuarios.Insert;
Result:=TJSONString.Create('Cadastro realizado com sucesso.');
end
else
begin
Result:=TJSONString.Create('Email já cadastrado.');
end;
finally
tbUsuarios.Close;
VCliente.Free;
end;
end;
I can print these TJSONString in TMemo , via Bind Visually , but I can not get the value of those messages and put < ShowMessage for example. In TMemo, it is displayed as below (JSONValue) ...
{
"result":
[
"Cadastro realizado com sucesso."
]
}
Does anyone know how to get the results from the client?
Thanks in advance!