Results 1 to 5 of 5

Thread: QSQLITE | unable to establish connection

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: QSQLITE | unable to establish connection

    Hi,
    why twice "!"?
    I dont know if it makes a difference. But I usually create the db on the stack ...
    And maybe first set the database name and then .open().
    Qt Code:
    1. if(m_db->open())
    To copy to clipboard, switch view to plain text mode 

    Qt 3.8 ... . Maybe you created the sqlite db with a different (later) version of sqlite.
    Last edited by janus; 1st July 2008 at 12:07.

  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1
    Thanked 29 Times in 27 Posts

    Default Re: QSQLITE | unable to establish connection

    Yeah, Janus is right you probably need to do this

    Qt Code:
    1. QSqlDatabase *m_db = QSqlDatabase::addDatabase("QSQLITE");
    2.  
    3. m_db->setHostName( "localhost" );
    4. m_db->setDatabaseName("ResumeDataBase");
    5.  
    6. if ( ! m_db->open( ) ) {
    7. QSqlError l_sqlError = m_db->lastError();
    8. QString l_sqlErrorString = l_sqlError.text();
    9. QMessageBox::information(this, "RTS", l_sqlErrorString);
    10. }
    To copy to clipboard, switch view to plain text mode 
    I'm a rebel in the S.D.G.

Similar Threads

  1. Client/Server Error: BadIDChoice
    By 3nc31 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 11:22
  2. QSQLITE Unable to fetch row in create
    By xgoan in forum Newbie
    Replies: 3
    Last Post: 18th October 2006, 15:39

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.