Results 1 to 15 of 15

Thread: column out of range problem

Hybrid View

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

    Default Re: column out of range problem

    Quote Originally Posted by d_stranz View Post
    HINT, HINT: Your query is not returning you the record you think it is. The table you are querying has a field named "productId", but it doesn't have fields named "Rate" or "Stock" and so the record your query returns doesn't have more than one column.

    As I said earlier, open your database using MySQL Workbench and actually look at the structure of the database and the tables in it. Then look at the query you are constructing in your code and see if it matches what you see in the Workbench.
    It is very strange to me. If the table has no columns, query->exec() should return false. The list of the record columns showed 3 names.
    Either the code shown is different from the real code or MySQL is behaving strangely.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,335
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    317
    Thanked 871 Times in 858 Posts

    Default Re: column out of range problem

    It is very strange to me. If the table has no columns, query->exec() should return false. The list of the record columns showed 3 names.
    Either the code shown is different from the real code or MySQL is behaving strangely.
    That was my thought too, but the OP claims everything is working except for the missing columns. There is no code to show how "query" is being created and used prior to the code snippet given in the first post..
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QMYSQLResult::data: column 1 out of range
    By rahulvishwakarma in forum Qt Programming
    Replies: 1
    Last Post: 6th June 2020, 05:18
  2. ODBC driver error QODBCResult::data: column out of range
    By Andrewgaven in forum Qt Programming
    Replies: 6
    Last Post: 16th January 2013, 10:30
  3. Index out of range problem for a xml file
    By Niamita in forum Qt Programming
    Replies: 1
    Last Post: 3rd November 2011, 08:11
  4. Qt Creator Problem with column indenting
    By pauljurczak in forum Qt Tools
    Replies: 3
    Last Post: 30th March 2011, 16:56
  5. QList index out of range problem
    By MarkoSan in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2008, 09:40

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.