Results 1 to 2 of 2

Thread: Sqlite e QT4

  1. #1

    Default Sqlite e QT4

    Hi Well I wonder to what extent should I save the database (. Sqlite,. Dat,. Sql)? And there's no User or password, which I put in these fields?

    I'm using QT4 and SQLite. OS: Windows

    thanks.

    void Principal::conectarBanco()
    {
    bancoDeDados = QSqlDatabase::addDatabase("QSQLITE");
    bancoDeDados.setDatabaseName("sistema-transporte-db.dat");
    bancoDeDados.setHostName("localhost");
    bancoDeDados.setPassword("");
    bancoDeDados.setUserName("");
    bool ok = bancoDeDados.open();
    if(!ok)
    QMessageBox::critical(0, "Driver Sql Lite", tr("Driver Not Found"));
    }

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Sqlite e QT4

    Quote Originally Posted by vinny gracindo View Post
    what extent should I save the database (. Sqlite,. Dat,. Sql)?
    It doesn't matter. Name the file how ever you like. I personally use *.db.

    And there's no User or password
    because sqlite doesn't support users and passwords. So just skip that lines.


    EDIT: also skip the host. It isn't needed either.

Similar Threads

  1. access SQlite from Qt (Windows & Linux)
    By Qt Coder in forum Qt Programming
    Replies: 13
    Last Post: 22nd July 2009, 10:07
  2. steps to connect to SQLite from Q
    By Qt Coder in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2009, 12:12
  3. Qt SQLite user functions
    By cevou in forum Qt Programming
    Replies: 1
    Last Post: 10th March 2009, 19:43
  4. sqlite version in Qt
    By janus in forum Newbie
    Replies: 4
    Last Post: 5th February 2009, 14:18
  5. sqlbrowser and sqlite
    By janus in forum Installation and Deployment
    Replies: 2
    Last Post: 31st March 2008, 14:59

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.