Results 1 to 5 of 5

Thread: Getting an Auto Increment value from QSqlTableModel with OnManualSubmit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    70
    Thanks
    12
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Getting an Auto Increment value from QSqlTableModel with OnManualSubmit

    I haven't tried it out yet but that looks like the answer I'm looking for.

    Wysota, I haven't completely confirmed this but passing NULL to an auto increment works great with MySql but I was having trouble with it when using ODBC and MSSQL on Windows.

    I'll be testing out that NULL problem soon and post the results here but I have been little tied up as my wife just gave birth to our first child.

  2. #2
    Join Date
    May 2006
    Posts
    70
    Thanks
    12
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Getting an Auto Increment value from QSqlTableModel with OnManualSubmit

    I "accidentally" continued this post on a different thread. My apologies.

    Click here for that thread.

    @wysota passing NULL as the auto-increment value is the correct way of doing it in both MySQL and ODBC, thanks.

    @trueneo: what you suggested doesn't work for 2 reasons. First the QODBC driver does not support lastInsertId and secondly QSqlDatabase does not have a lastInsertId method.

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.