Results 1 to 9 of 9

Thread: Basic Qt Sql Question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Basic Qt Sql Question

    Try "qry.lastError().text()" @ line 39 in lieu of "db.lastError().text()"

  2. #2
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Basic Qt Sql Question

    now the error changes like:

    error = "near "1": syntax error Unable to execute statement"

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Basic Qt Sql Question

    What wysota was trying to say to you is: You are using the wrong database driver for MySql. This is most probably also the reason why the query throws an error. Not all database systems understand the same SQL commands.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Basic Qt Sql Question

    Quote Originally Posted by sidenelen View Post
    now the error changes like:
    And if you correct the syntax? Does it work then?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Basic Qt Sql Question

    Yours SQL query is bad
    Qt Code:
    1. SELECT * FROM `tablo` 1
    To copy to clipboard, switch view to plain text mode 
    It should be
    Qt Code:
    1. SELECT * FROM `tablo`
    To copy to clipboard, switch view to plain text mode 
    or
    Qt Code:
    1. SELECT * FROM `tablo` WHERE 1
    To copy to clipboard, switch view to plain text mode 
    Of course, the latter figure does not make sense.

  6. #6
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Basic Qt Sql Question

    @Lesiok
    Yeah, I corrected the code as you said and it works! Thank you all guys

Similar Threads

  1. basic C++ question
    By Maluko_Da_Tola in forum Newbie
    Replies: 3
    Last Post: 24th August 2010, 08:29
  2. very basic Qt/c++ question
    By Maluko_Da_Tola in forum Newbie
    Replies: 2
    Last Post: 25th July 2010, 14:02
  3. A few basic question
    By salmanmanekia in forum Newbie
    Replies: 12
    Last Post: 17th June 2010, 07:46
  4. Basic question
    By giacomelli.fabio in forum Newbie
    Replies: 4
    Last Post: 18th December 2009, 00:12
  5. Using QSA: A very basic question
    By yogeshm02 in forum Newbie
    Replies: 3
    Last Post: 26th January 2006, 07:34

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.