Results 1 to 6 of 6

Thread: QDataMapper not saving data on mapper submit

  1. #1
    Join Date
    Aug 2010
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QDataMapper not saving data on mapper submit

    I am very new, so forgive my ignorance. I have been trying for hours to get the mapper->submit to work and am failing miserabley. I can see the data on my form ok, but if I make changes and press my save button which only does mapper->submit I get QSqlquery errors about not positioned on a valid record. I can display message that tell me I have a valid record, so I am not sure what is going on. I am using a mysql db and the qodbc. Does that make a difference? What am I doing wrong?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QDataMapper not saving data on mapper submit

    Does your table have a defined primary key?

  3. #3
    Join Date
    Aug 2010
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDataMapper not saving data on mapper submit

    Yes it does, although the key has multiple parts. Do I need a primary index with just one field?

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QDataMapper not saving data on mapper submit

    I think the ODBC driver might but I cannot test that at the moment. Are you able to test it or use the native MySql driver?

  5. #5
    Join Date
    Aug 2010
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDataMapper not saving data on mapper submit

    I will test today with a single field primary index. I am not able to get the qmysql odbc to work.

  6. #6
    Join Date
    Aug 2010
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDataMapper not saving data on mapper submit

    I tested the single field primary index and then the mapper.submit appeard to work but when I do the model.submitall I get an error invalid column '' in where clause and my data does save to the db.

Similar Threads

  1. Saving and storing data,QtSql
    By salmanmanekia in forum Newbie
    Replies: 7
    Last Post: 20th April 2010, 19:08
  2. Replies: 6
    Last Post: 20th January 2010, 04:16
  3. Saving hierarchical structures of data.
    By psih128 in forum Qt Programming
    Replies: 1
    Last Post: 30th July 2009, 08:33
  4. Saving pure plot data to image file
    By Debilski in forum Qwt
    Replies: 4
    Last Post: 7th April 2009, 17:02
  5. Replies: 3
    Last Post: 21st January 2008, 12:22

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.