Results 1 to 5 of 5

Thread: First last button suggestions

  1. #1
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Red face First last button suggestions

    In my continuing quest for trying to build a database that tracks the music I have written, I have come to another wall. I am trying to insert 4 buttons in a form, First Next Prev and Last. Do you guys have any suggestions? I have checked the demos and examples and the documentation, but I don't really understand it. So far I have :
    Qt Code:
    1. void nnDBSPieceViewForm::firstPushButtonSlot()
    2. { QSqlQuery query("SELECT piece_name FROM main ORDER BY uid");
    3. query.exec();
    4. query.first();
    5. ui.pieceNameLineEdit->setText(query.value(0).toString());
    6. qDebug("firstPushButton Pressed");
    7. } // End firstPushButtonSlot
    To copy to clipboard, switch view to plain text mode 
    It compiles fine, but when I click the First button, in the console I receive:
    QODBCResult::exec: Unable to execute statement:
    [Microsoft][ODBC Driver Manager] Function sequence error
    QSqlQuery::value: not positioned on a valid record
    firstPushButton Pressed
    Any suggestions?
    Thanks in advance,

    fnmblot
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  2. #2
    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: First last button suggestions

    Try query.next() instead of query.first(). BTW. It doesn't have anything to do with buttons

  3. #3
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: First last button suggestions

    Unfortunately, the query.next() did not work. I received the exact same error in the console. I think I will try a different approach this weekend, probably QSqlQueryModel. I was able to run SELECT queries that way before.

    Thanks!
    fnmblot
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: First last button suggestions

    Quote Originally Posted by fnmblot
    QSqlQuery query("SELECT piece_name FROM main ORDER BY uid");
    query.exec();
    You try to execute the query twice --- maybe that's the problem?

  5. #5
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Talking Re: First last button suggestions

    You were absolutely right! Looks like the second query was just sending an empty query, hence the error messages. I took that one out and the query executed just fine.

    Once again, thank you guys so much! I don't know what I would do without you all.

    fnmblot
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

Similar Threads

  1. Create a new button
    By avis_phoenix in forum Qt Programming
    Replies: 7
    Last Post: 3rd September 2006, 18:56
  2. Paint XP radio button to pixmap
    By Ben.Hines in forum Qt Programming
    Replies: 2
    Last Post: 26th April 2006, 21:15
  3. Push Button problem!!
    By Seema Rao in forum Qt Programming
    Replies: 1
    Last Post: 22nd April 2006, 16:31
  4. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 16:40
  5. QLabel on a Button
    By cwalsh in forum Newbie
    Replies: 4
    Last Post: 12th January 2006, 16:06

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.