1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Visual C++ Code

Discussion in 'Programming' started by Šatra, Mar 26, 2020.

  1. #1
    Hi.
    This marked code at the picture is correct in MySQL Workbench, but no in visual Studio.
    I had message:
    You have an error in your SQl syntax; check the manual that corresponds to your My SQL server version for the right syntax to use near ')' at line 1. Untitled7.png
     
    Šatra, Mar 26, 2020 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    I don't know c++ but I'd start by putting the SQL into a string that you can echo/print out and put into the database directly and see if that makes the error clearer.

    My gut tells me the problem might be in the content of the new title and that it might have an ' in it - something like O'Reilly will break your code.

    upload_2020-3-27_14-38-58.png
     
    sarahk, Mar 26, 2020 IP
  3. Šatra

    Šatra Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    I checked and it does not work again.
     
    Šatra, Mar 27, 2020 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #4
    Can you give us an example of the SQL string?
     
    sarahk, Mar 27, 2020 IP
  5. Šatra

    Šatra Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #5
    Untitled11.png
     
    Šatra, Mar 27, 2020 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #6
    emp_no would be a unique value wouldn't it?
    The query looks really strange and I'm deep in another project so I'm possibly just not on the right wavelength but isn't this what you need:

    update titles 
    set titles.title = 'Staff'
    where titles.emp_no = 10001
    Code (markup):
    Why was the view even in the query?
    What is the to_date column doing? If emp_no is unique then it's adding no extra value
     
    sarahk, Mar 27, 2020 IP
  7. Šatra

    Šatra Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #7
    To_date is important beacuse it is max_date in view6 and I update salary(in table salaries) in row where to_date is max. In fact, my code works in MySQL Workbench, but no in Visual Studio
     
    Šatra, Mar 27, 2020 IP
  8. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #8
    How is it relevant to finding and updating the title of emp_no 10001?
     
    sarahk, Mar 27, 2020 IP
  9. Šatra

    Šatra Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #9
    What this message is telling me?
    You have an error in your SQl syntax; check the manual that corresponds to your My SQL server version for the right syntax to use near ')' at line 1.
     
    Šatra, Mar 27, 2020 IP
  10. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #10
    What's your experience with SQL?
    I ask because it's VERY easy to break down and locate the error.
     
    NetStar, Mar 27, 2020 IP
  11. Šatra

    Šatra Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #11
    It is first time for me to use SQL which is within another project.
     
    Šatra, Mar 28, 2020 IP
  12. Šatra

    Šatra Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #12
    I realised where error is. The error is ")"(bracket).
     
    Šatra, Mar 29, 2020 IP