Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SOLVED: Using MS SQL Server 2013 Database with QT
Forum Updated to NodeBB v4.3 + New Features

SOLVED: Using MS SQL Server 2013 Database with QT

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M001
    wrote on last edited by
    #1

    Hallo, I'm trying to connect my MS SQL Server Database to my QT Projekt. This is my code:
    @#include <QCoreApplication>
    #include <QtSql/QtSql>
    #include <QDebug>

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);

    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    db.setHostName("(localdb)\\Projects");
    db.setDatabaseName("PDB");
    db.setUserName("DOMAIN\\user");
    db.setPassword("");
    
    if (!db.open()) {
       qDebug() << db.lastError().text();
       return 1;
    }
    
    
    if (!db.open()) {
       qDebug() << db.lastError().text();
       return 1;
    }
    
    
    return a.exec(&#41;;
    

    } @

    But im allways getting this error:
    Microsoft ODBC Driver Manager / The Datasourcename could not be found, and there was no standard driver selected QODBC3: Unable to connect

    I have created the Database with Visual Studio 2013.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved