Results 1 to 5 of 5

Thread: MS Sql native driver??

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Location
    Germany
    Posts
    89
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default MS Sql native driver??

    Hello friends,

    I try to connect to a ms sql 2005 database. So I first try to use the QODBC driver ( QtSQL).

    Here is my Code:
    Qt Code:
    1. #include <QtGui>
    2. #include <QtSql>
    3. #include <QDebug>
    4.  
    5. int main(int argc, char* argv[]) {
    6. QApplication app(argc, argv);
    7.  
    8. QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    9. db.setHostName("localhost");
    10. db.setDatabaseName("ExapleDB");
    11. db.setUserName("Admin");
    12. db.setPassword("admin");
    13.  
    14. if (!db.open()) {
    15. QSqlError err = db.lastError ();
    16. QMessageBox::information(0, QObject::tr("Fehler"), err.text());
    17. return 1;
    18. }
    19. QTableView tableView;
    20. // --- Alle Daten abfragen ---
    21. model.setTable("Artikel");
    22. model.select();
    23. model.setEditStrategy(QSqlTableModel::OnFieldChange);
    24. tableView.setModel(&model);
    25. tableView.setWindowTitle("SQL-Demonstration");
    26. tableView.show();
    27. return app.exec();
    28. }
    To copy to clipboard, switch view to plain text mode 

    I search for the Driver QODBC but I d´ont find it. I have install Qt by the installer 4.3.1.
    Than I read the Docu and I read this
    Note: You should use native drivers in preference to the ODBC driver where they are available. ODBC support can be used as a fallback for compliant databases if no native drivers are available.
    First: Where can I found a native Driver for MS Sql 2005?
    Second: How can I install the QODBC driver, because in the standard installation I have only the qsqlite4.dll?
    Last edited by wysota; 9th October 2007 at 11:12. Reason: Changed tags

Similar Threads

  1. Building new SQL driver
    By Pragya in forum Installation and Deployment
    Replies: 1
    Last Post: 27th June 2007, 08:46

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.