title: How to load ODBC in qt
body: <p>I'm very new to <code>Qt</code> and <code>C++</code></p>
  
  <p>I'm trying to connect to an ODBC db, but I'm getting the following output</p>
  
  <pre><code>QSqlDatabase: QODBC driver not loaded
  QSqlDatabase: available drivers: QSQLITE 
  </code></pre>
  
  <p>How do I load <code>ODBC</code> in <code>Qt</code>. </p>
  
  <p>CODE :</p>
  
  <pre><code>QString serverName = "LOCALHOST\\SQLEXPRESS";
  QString dbName = "test";
  
  QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
  
  db.setConnectionOptions();
  
  QString myCon = QString("DRIVER={SQL Native Client};SERVER=%1;DATABASE=%2;Trusted_Connection = Yes").arg(serverName).arg(dbName);
  
  db.setDatabaseName(myCon);
  
  if(db.open())
  {
     qDebug() &lt;&lt; "Opened!";
     db.close();
  }
  else
  {
     qDebug() &lt;&lt; "Error : " &lt;&lt; db.lastError().text();
  }
  </code></pre>
  
  <p>I tried to follow the steps online, but it's very confusing. </p>
  
  <p>Can someone give me a simplified approach to doing this?</p>