Important: Please read the Qt Code of Conduct -

QSqldatabase and QT creator

  • HI All,

    I am working on QSqldatabase and i have following problem.
    I have create connection and but when i compile my code i am facing compilation error that QSqldatabase not declared. I have added in pro file QT += sql but i think something is missing.

    Is there any dll that will add support for QSql ?


  • Moderators

    You are using are using QSqlDatabase, and not QSqldatabase, right?

  • @#include <QSqlDatabase>@

    and as mlong said notice the capitalisation you are using is incorrect.

  • Did you add the SQL module in your .pro file for the Qt configuration?
    QT+= SQL

  • Also make sure that qmake has been re-run since you added QT += SQL so that the Makefiles (or equivalent) have been updated to include the necessary include and library paths etc.

Log in to reply