Jump to content
Fórum Script Brasil
  • 0

Syntax MySQL + Delphi dando erro UPDATE, WHERE


Question

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=’[email protected]’ 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 to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      149264
    • Total Posts
      645605
×
×
  • Create New...