title: QT sql programming
body: <p>include "mythread.h</p>
  
  <pre><code>mythread::mythread(int ID, QObject *parent) :
  QThread(parent)
  
  
  {
      this-&gt;socketDescriptor = ID;
      db = QSqlDatabase::addDatabase("QODBC");
      db.setHostName("127.0.0.1");
      db.setDatabaseName("mydsn");
  
  
  
      if (db.open())
      {
          qDebug() &lt;&lt; "DB is connected!";
          myquery-&gt;clear();
          myquery-&gt;exec("INSERT INTO phone_table(name_) VALUES ('asdhjs')");
          db.close();
      }
      else
      {
          qDebug() &lt;&lt; "Db is not connected!" &lt;&lt; db.lastError();
      }
  }
  </code></pre>
  
  <p>When I insert data its getting error 
  Myserver.exe
  Myserver.exe has stopped working
  Windows is checking for a solution to the problem...
  Can anyone help me ?</p>