TFDQuery

Delphi

02/12/2016

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

Curtidas 0

Melhor post

Raimundo Pereira

Raimundo Pereira

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
GOSTEI 1

Mais Respostas

Douglas

Douglas

02/12/2016

Fala Brunão, blz?

Posta o código do erro :)

Assim fica mais fácil de ajudar.

Abração.
GOSTEI 0
Bruno

Bruno

02/12/2016

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
GOSTEI 0
Bruno

Bruno

02/12/2016

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.
GOSTEI 0
POSTAR