PDA

View Full Version : Problem in executing SqLite Query in C++ project



RamrajCh
29th June 2019, 06:06
Hello,
I am trying to connect to database SBS.sqlite using QT.
I sucessfully connect my database but I couldn't execute query.

I have attatched mainwindow.cpp and mainwindow.h with this thread.
The problem I mentioned is invoid MainWindow::on_registerButton_2_clicked() function.

ChristianEhrlicher
29th June 2019, 08:12
Firstz make sure that the table really exists, and then you should also bind (https://doc.qt.io/qt-5/qsqlquery.html#approaches-to-binding-values) the values you want to store in the db

RamrajCh
29th June 2019, 08:41
Now,I have done it. But the problem is same. It would not execute query.

ChristianEhrlicher
29th June 2019, 08:54
Then you should take a look at QSqlQuery::lastError() (https://doc.qt.io/qt-5/qsqlquery.html#lastError) after preparing and executing your query.