Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erro ao Incluir dados cujo campo no Select não pertence a tabela #5

Closed
ANTCARLOS opened this issue May 6, 2023 · 1 comment
Closed

Comments

@ANTCARLOS
Copy link

Bom dia!
Estou relatando um erro que acontece no ADRConnetion.
O erro acontece quando vou INSERIR um registro quando um campo no select não pertence a tabela,
a rotina LDataSet.LoadFromJSON(AValue), entra em loop e não estoura a exception.
No meu caso estou usando o PostMan e nada é retornado, nem o Status.


function TDAOPADRAO.Insert(AValue: string): TJSONObject;
{$REGION 'SELECT'}
const
LSQL = 'SELECT ??????? IDTENACY, IDEMP, DTVENDA FROM MOVENDA WHERE 1 = 1';
{$ENDREGION}
var
LDataSet: TDataSet;
begin
Try
try
LDataSet := FQuery.SQL(LSQL).OpenDataset;

  LDataSet.LoadFromJSON(AValue);

  Result := LDataSet.ToJSONObject;
Except
  on E: Exception do
  Begin
    Result := TJSONObject.create;
    Raise Exception.create(E.Message);
  End;
end;

finally
LDataSet.free;
end;
end;

@adrianosantostreina
Copy link
Owner

Retire o campo da SELECT que não pertence a tabela. Você não precisa dele pra fazer o IINSERT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants