Results 1 to 4 of 4

Thread: QSqlTableModel select() fails with QODBC connection to SQL Express?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Location
    United States
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlTableModel select() fails with QODBC connection to SQL Express?

    We have liftoff!

    Both problems are resolved by modifying odbc.pro and adding the Q_ODBC_VERSION_2 define to exclude all unicode support for unix:
    Qt Code:
    1. TARGET = qsqlodbc
    2.  
    3. HEADERS = ../../../sql/drivers/odbc/qsql_odbc.h
    4. SOURCES = main.cpp \
    5. ../../../sql/drivers/odbc/qsql_odbc.cpp
    6.  
    7. unix {
    8. !contains( LIBS, .*odbc.* ) {
    9. LIBS *= $$QT_LFLAGS_ODBC
    10. }
    11. DEFINES += Q_ODBC_VERSION_2
    12. }
    13.  
    14. win32 {
    15. !win32-borland:LIBS *= -lodbc32
    16. win32-borland:LIBS *= $(BCB)/lib/PSDK/odbc32.lib
    17. }
    18.  
    19. include(../qsqldriverbase.pri)
    To copy to clipboard, switch view to plain text mode 

    The setTable call is now able to grab metadata from the table and populates all string fields correctly so QSqlTableModel and QTableView work as expected:


    Also QSqlQuery no longer fails on SQLGetData and retrieves string data from select statements and store procedures as desired.

    OMG I wish I would have found and tried this on Monday ... it's always something stupid and simple!
    Last edited by ajg85; 8th April 2010 at 21:46.

Similar Threads

  1. QSqlDatabase::open() fails with QODBC
    By grzywacz in forum Qt Programming
    Replies: 4
    Last Post: 7th April 2010, 04:27
  2. QSqlTableModel::select()
    By vladozar in forum Qt Programming
    Replies: 4
    Last Post: 29th April 2009, 18:51
  3. Queued connection fails on own class
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 2nd December 2008, 19:50
  4. QODBC, QSqlTableModel, and submit problems
    By darkadept in forum Qt Programming
    Replies: 3
    Last Post: 18th May 2008, 13:46
  5. Qt 4 commercial with Visual C++ 2005 Express Edition: Works half, debug fails
    By axeljaeger in forum Installation and Deployment
    Replies: 4
    Last Post: 5th July 2006, 06:38

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.