UPDATE syntax error in delphi (MySQL)

2

Good night .... I'm using a procedure in msm style for all modules of my software using the msm structure of UPDATE and they all worked, but when I went to do the system users update this is returning me the error: syntax of the incorrect UPDATE command ... I will leave the code below someone please know what is happening? Thank you

    procedure TModulo.EditarUsuario(idPr: Integer; userPr: string; senhaPr:        string);
    begin

   with reserva do begin

       Close;
        SQL.Clear;
        SQL.Add('UPDATE usuarios SET user = :userPr, senha = :senhaPr ' +
    'where id = ' + IntToStr(idPr));

        Parameters.ParamByName('userPr').Value := userPr;
        Parameters.ParamByName('senhaPr').Value := senhaPr;

        ExecSQL;

    end;

      //resetando para visualização
      DMDados.Modulo.reserva.close;
      DMDados.Modulo.reserva.sql.Clear;
      DMDados.Modulo.reserva.sql.Add('select * from usuarios');
      DMDados.Modulo.reserva.open;
      //resetando para visualização</>

    end;
    
asked by anonymous 08.11.2016 / 00:55

1 answer

4

As far as I can see, I just mentioned specifying the ID in ParamByName

reserva.Close;
reserva.SQL.Clear;
reserva.SQL.Add('UPDATE USUARIOS SET');
reserva.SQL.Add('USER = :USERPR,');
reserva.SQL.Add('SENHA = :SENHAPR');
reserva.SQL.Add('WHERE ID = :IDPR');

reserva.ParamByName('IDPR').AsInteger := idPr;
reserva.ParamByName('USERPR').AsString := userPr;
reserva.ParamByName('SENHAPR').AsString := senhaPr;
reserva.ExecSQL;
    
08.11.2016 / 02:27