I need update a field value , increasing the old value. something like ths
UPDATE MYTABLE SET FIELD1=FIELD1+VALUE WHERE ....
but when run the next code i have this error
Parameter object is improperly defined. Inconsistent or incomplete information was provided
this is my code
AdoQuery:=TADOQuery.Create(nil);
try
AdoQuery.Connection:=FAdoConnection;
AdoQuery.Active:=False;
AdoQuery.Parameters.CreateParameter('RECON',ftFloat,pdInput,SizeOf(Double),d1);
AdoQuery.Parameters.CreateParameter('NUM',ftInteger,pdInput,SizeOf(Integer),Trans);
AdoQuery.Parameters.CreateParameter('LIN' ,ftInteger,pdInput,SizeOf(Integer),Lin);
AdoQuery.SQL.Clear;
AdoQuery.SQL.Add('UPDATE DIPTT SET VALRECON=:RECON+VALRECON WHERE NUM=:NUM AND LIN=:LIN');
AdoQuery.Prepared:=True;
AdoQuery.ExecSQL;
finally
if AdoQuery.Active then AdoQuery.Close;
AdoQuery.Free;
end;
i tried multiples combinations
1)
AdoQuery.SQL.Add('UPDATE DIPTT SET VALRECON=VALRECON+:RECON WHERE NUM=:NUM AND LIN=:LIN');
2)
AdoQuery.SQL.Add('UPDATE DIPTT SET VALRECON=(VALRECON)+:RECON WHERE NUM=:NUM AND LIN=:LIN');
Only when i tried this it works. (obviously this is not a valid option, but show me where the problem is)
AdoQuery.SQL.Add('UPDATE DIPTT SET VALRECON=:RECON WHERE NUM=:NUM AND LIN=:LIN');
How can rewrite this sentece?
Any clues?