include "mythread.h
mythread::mythread(int ID, QObject *parent) :
QThread(parent)
{
this->socketDescriptor = ID;
db = QSqlDatabase::addDatabase("QODBC");
db.setHostName("127.0.0.1");
db.setDatabaseName("mydsn");
if (db.open())
{
qDebug() << "DB is connected!";
myquery->clear();
myquery->exec("INSERT INTO phone_table(name_) VALUES ('asdhjs')");
db.close();
}
else
{
qDebug() << "Db is not connected!" << db.lastError();
}
}
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 ?