GARANTIR DESCONTO

Fórum TFDQuery #572018

02/12/2016

0

Alguem sabe o que pode estar dando errado?

with dm.sql_update_dpto do
begin
Close;
SQL.Clear;
SQL.Add('select ID_DPTO_P from EQ_DPTO Where ID_DPTO='+dm.sql_depto_NEREUS.FieldByName('ID').AsString);
Open;

Edit;
FieldByName('ID_DPTO_P').Value := dm.sql_grp.FieldByName('ID').AsInteger;

try
Post;
except
On E:Exception do
ShowMessage(E.Message);
end;
end;
end;
Bruno

Bruno

Responder

Post mais votado

02/12/2016

Acredito que você não pode realizar update em um campo AutoIcrement
Mais veja

ID_DPTO_P = x
ID_DPTO =y

ID_DPTO_P =ID_DPTO_P
ID_DPTO =ID_DPTO




Ou seja você está dizendo que o campo ID vai ser igual a ele mesmo quando ele for igual a ele?
Veja

update EQ_DPTO set x=:x Where y=:y

Raimundo Pereira

Raimundo Pereira
Responder

Gostei + 1

Mais Posts

02/12/2016

Douglas

Fala Brunão, blz?

Posta o código do erro :)

Assim fica mais fácil de ajudar.

Abração.
Responder

Gostei + 0

02/12/2016

Bruno

na verdade ele tava gerando um erro, mas agora eu tentei colocar la de novo pq eu tava tentando fazer de outra forma, ai ele nao aparece nada como erro... simplesmente nao esta fazendo nada
Responder

Gostei + 0

02/12/2016

Bruno

Eu tentei da seguinte forma agora:

var1 := dm.sql_grp.FieldByName(''ID'').AsString;
var2 := dm.sql_depto.FieldByName(''ID'').AsString;

with dm.sql_update_dpto do
begin
Close;
SQL.Clear;
SQL.Add(''update EQ_DPTO set ID_DPTO_P=:ID_DPTO_P Where ID_DPTO=:ID_DPTO'');

ParamByName(''ID_DPTO_P'').Value := var1;
ParamByName(''ID_DPTO'').Value := var2;

try
ExecSQL;
except
On E:Exception do
ShowMessage(E.Message);
end;
end;

e deu o seguinte erro:


[FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0][Sql Server]A trigger returned a resultset and/or was running with SET NOCOUNT OFF while another outstating result set wa active.
Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar