Ir para conteúdo
Fórum Script Brasil
  • 0

Syntax MySQL + Delphi dando erro UPDATE, WHERE


Sergio Feitoza

Pergunta

Por favor me ajude com o seguinte Eu tenho um código com Delphi + MySQL Server 8.0 Community version. Funciona bem. Estou tentando fazer um UPDATE como no código a seguir. Tentei várias alternativas e sempre recebo a mensagem de erro:

 Error #42000 You have na error in your SQL syntax check the manual that corresponds to your MySQL server version for the right syntax to use near “WHERE LOGIN=’ZZ@cogn.com’ AND DATEREGISTER=’2021-05-03 17:58:20’’ at line 1

POdem me ajudar a saber qual é o erro de sintaxe ?

 

       uniMainModule.USERS.IndexFieldNames:='DATEREGISTER';

       Nregisteredusers:=uniMainModule.USERS.RecordCount;

       NDATE: = unimainmodule.USERS.fieldByname('DATEREGISTER').AsDateTime;

       NUSERX: = unimainmodule.USERS.fieldByname('LOGIN').AsString;

       NSITE: = unimainmodule.USERS.fieldByname('SITEVISITS').AsInteger;

       ASSE:= unimainmodule.USERS.fieldByname('ASSESSMENT').AsInteger;

       AddNewUser := TMyQuery.Create(nil);

        try

   AddNewUser.Connection := uniMainModule.MyConnection;

    AddNewUser.SQL.Clear;

 

 AddNewUser.SQL.text: ='UPDATE USERS SET SITEVISITS = :NSITE, ASSESSMENT = :ASSE,' +

      ' WHERE LOGIN=: NUSERX AND DATEREGISTER=: NDATE';

 AddNewUser.Params.ParamByName('NSITE').AsInteger := NSITE;

 AddNewUser.Params.ParamByName('ASSE').AsInteger := ASSE;

 AddNewUser.Params.ParamByName('NUSERX').AsString := NUSERX;

 

 AddNewUser.ExecSQL;

      finally

               FreeAndNil(AddNewUser)

      end;

 

 

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...