Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9241655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:24:35+00:00 2026-06-18T08:24:35+00:00

I am trying to connect to SQL Server 2008R2 with my qt application in

  • 0

I am trying to connect to SQL Server 2008R2 with my qt application in windows but I am getting errors. Here’s what I am doing:

#include "ui_test1.h";
#include "QtSql/QtSql";

void Test1::on_btnsnd_clicked()
{
    QSqlDatabase db = QSqlDatabase::addDatabase("ODBC");

    db.setHostName("ITPL_PC1");
    db.setDatabaseName("Test");
    db.setUserName("sa");
    db.setPassword("insforia");
    db.open();
    QSqlQueryModel *model = new QSqlQueryModel;

    QString query = "insert into qttable(PID) values('ARUP')";
    model->setQuery(query, db);

    db.close();
}

i am getting this error 27 times :

 test1.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport)        public: __thiscall QSqlDatabase::~QSqlDatabase(void)" (__imp_??1QSqlDatabase@@QAE@XZ) referenced in function "private: void __thiscall Test1::on_btnsnd_clicked(void)" (?on_btnsnd_clicked@Test1@@AAEXXZ)

I don’t know how to do this (I found this in google.)

What should I do to fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:24:36+00:00Added an answer on June 18, 2026 at 8:24 am

    If you use MSVC, you should add %QTDIR%/lib/QtSql4.lib to Release configuration of your project and %QTDIR%/lib/QtSqld4.lib to Debug one. You should change 4 in file names to 500, if you use Qt 5.0. So, file names would be %QTDIR%/lib/QtSql500.lib and %QTDIR%/lib/QtSqld500.lib

    Project Properties


    If you use QtCreator you should add the next line into your .pro file

    QT += sql
    

    Upd: added description for QtCreator’s .pro file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to connect to a SQL Server 2005 instance remotely but getting the following
I am trying to connect SQL Server from a Windows service. Now my Windows
I am trying to connect to SQL Server 2008 server from Java here is
I've been trying to connect SQL Server with VB6. I'm running Windows 2000 on
I am trying to connect to sql server using vb.net but I got this
I am trying to connect SQL server 2008 r2 with my java application using
I am trying to connect to sql server 2005 from my Java application using
i am trying to connect with sql server 2008 using java connection string but
I'm trying to connect to SQL Server using Windows authentication. The code works fine
I'm trying to connect to SQL Server 2008 R2 from a C++ application as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.